我正在尝试使用 c++ 创建一个货币转换程序,我不知道如何继续
I'm trying to create a currency conversion program with c++, I don't know how to continue
#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;
}
相关文章:
- 防止主数据类型C++的隐式转换
- 模板参数替换失败,并且未完成隐式转换
- 努力将整数转换为链表。不知道我在这里做错了什么
- HEX值到wchar_t字符(UTF-8)的转换
- lambda参数转换为constexpr技巧,然后获取带链接的数组
- 将 Qvector<uint8_t> 转换为 QString
- 如何在cuSparse中使用cusparseXcoo2csr从coo转换为csc
- 有关插入适配器的错误。[错误]请求从 'back_insert_iterator<vector<>>' 类型转换为非标量类型
- 在c++中使用nlohmann从类到json的转换
- 从"int*"强制转换为"unsigned int"会丢失精度错误
- 将Integer转换为4字节的unsined字符矢量(按大端字节顺序)
- 处理小于cpu数据总线的数据类型.(c++转换为机器代码)
- 如何使用OpenCV将RBG图像转换为HSV,并将H、S和V值保存为C++中的3个独立图像
- 复制列表初始化的隐式转换的等级是多少
- 正在将指针转换为范围
- 我正在尝试使用 c++ 创建一个货币转换程序,我不知道如何继续
- C++ 货币转换器尾随零
- C++ -- 如何使用开关语句和恒量获得有效的货币转换器
- C++货币转换代码
- 超级简单的货币转换开关行为奇怪