私はC++を始めたばかりで、最初の数日間に学んだことのいくつかをいじっているだけです。私が書いたこのプログラムは、ユーザー入力で戻り可能なパラメーターを使用する方法を理解しようとする以外に本当の目的はありません。これをコンパイルしようとすると、すべてがおかしくなりました。どうしたの?
ここに私が書いたコードがあります:
#include <iostream>
// defining the Parameters of Add and Multply
int add(int a, int b)
{
return a + b;
}
int multiply(int c, int d)
{
return c * d;
}
int main ()
{
using namespace std;
// user defines vairables
int x;
int y;
int w;
int z;
cout << "enter x value now:" << endl;
cin >> x >> endl;
cout << "enter y value now" << endl;
cin >> y >> endl;
cout << "enter w value now" << endl;
cin >> w >> endl;
cout << "enter z value now" << endl;`
cin >> z >> endl;
//computation of variables
cout << "computing x and y factors" << add(x, y) << endl;
cout << "computing w and z cordinates" << multiply(w, z) << endl;
cout << " " << endl;
cout << "final answer is: " << add(x, y) + multiply(w, z) << endl;
cin.clear();
cin.ignore(255, '\n');
cin.get();
return 0;
}