我正在尝试使用 c++ 创建一个货币转换程序,我不知道如何继续

I'm trying to create a currency conversion program with c++, I don't know how to continue

本文关键字:转换 货币 一个 程序 我不知道 继续 何继续 创建 c++      更新时间:2023-10-16
#include <iostream>
using namespace std;
int Convert(int dollars)
{
int amount = dollars * 113;
cin >> dollars;
} 
int main ()
{
Convert ();
count << "Enter the amount you want to convert";
}

您的程序有多个问题,首先它需要一个您没有提供的参数,将cin移动到main并将输入发送到Convert()函数。然后,返回转换并打印。

#include <iostream>
using namespace std;
int Convert(int dollars)
{
return (dollars * 113);
} 
int main ()
{
int amount;
cout << "Enter the amount you want to convert and press enter ";
cin >> amount;
cout << "Result is = " << Convert(amount) << endl;
return 0;
}