📅  最后修改于: 2020-09-25 06:29:03             🧑  作者: Mango
#include
using namespace std;
int main()
{
double firstNumber, secondNumber, productOfTwoNumbers;
cout << "Enter two numbers: ";
// Stores two floating point numbers in variable firstNumber and secondNumber respectively
cin >> firstNumber >> secondNumber;
// Performs multiplication and stores the result in variable productOfTwoNumbers
productOfTwoNumbers = firstNumber * secondNumber;
cout << "Product = " << productOfTwoNumbers;
return 0;
}
输出
Enter two numbers: 3.4
5.5
Product = 18.7
在此程序中,要求用户输入两个数字。用户输入的这两个数字分别存储在变量firstNumber
和secondNumber
。
然后,对firstNumber
和secondNumber
的乘积求值,并将结果存储在变量productOfTwoNumbers
。
最后, productOfTwoNumbers
将显示在屏幕上。