I've been learning C++ for a bit and tried my hand at making a simple function that returns the area of a room. The return statement doesn't output the value, however using cout I can see the result. Am I missing something here?
#include <iostream>
using namespace std;
int Area(int x, int y);
int main()
{
int len;
int wid;
int area;
cout << "Hello, enter the length and width of your room." << endl;
cin >> len >> wid;
cout << "The area of your room is: ";
Area(len, wid);
return 0;
}
int Area(int len, int wid)
{
int answer = ( len * wid );
return answer;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…