basic code error

closed account (Diz60pDG)
I am writing a C++ code for a class that has to convert yards and feet to inches and add up all the values to get the total number of inches. When I try to run the code in Visual Studio I get an error that says "error C4430: missing type specifier - int assumed"

Thank you for any advice or help!!



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  
#include <iostream>
using namespace std;

main()
{
	int yards;
	int feet;
	int inches;
	int answer;

	cout << "Enter the number of yards: ";
	cin >> yards;
	cout << "Enter the number of feet: ";
	cin >> feet;
	cout << "Enter the number of inches: ";
	cin >> inches;

	answer = ((yards * 36) + (feet * 12) + (inches));
	cout << "The total number of inches is " << answer << endl;

	return 0;
}
You have forgot the return type of main()

 
int main()
closed account (Diz60pDG)
I have very recently started coding and am still trying to learn.
Thanks so much.
Topic archived. No new replies allowed.