1.4
1 //Exercise 1.4: Our program used the addition operator, +, to add two numbers. Write a program that uses the multiplication operator, *, to print the product instead. 2 #include<iostream> 3 int main() 4 { 5 std::cout << "Enter two numbers:" << std::endl; 6 int v1 = 0, v2 = 0; 7 std::cin >> v1 >> v2; 8 std::cout << "The product of " << v1 << " and " << v2 << " is " << v1*v2 << std::endl; 9 return 0; 10 }
时间: 2024-10-01 20:41:59