![](/img/trans.png)
[英]I'm trying to link assembly code to C++, but I don't know how it works
[英]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()
function。 然后,返回轉換並打印。
#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;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.