int unexpected error

string name, // first name, typed in by the user
int ageInYears, // age typed in by the user
ageDiff, // difference between user's age and
// AGE_MODIFIER
minHeartRate, // minimum estimated heart rate
maxHeartRate; // maximum estimated heart rate

I am getting int error referenced to this line of code. I have converted semi colons to commas but don't see any int error this is my first program no idea where to start. Have looked at my resources first. would like some suggestions. Thank you Peter
1
2
3
4
5
6
7
8
9
 
string name;    /* semicolon here*/   // first name, typed in by the user
int ageInYears, // age typed in by the user 
ageDiff, // difference between user's age and 
// AGE_MODIFIER
minHeartRate, // minimum estimated heart rate
maxHeartRate; // maximum estimated heart rate

Last edited on
I am getting int error referenced to this line of code.
What does the error message say?
1
2
string name;
int ageInYears, ageDiff, minHeartRate, maxHeartRate;


You can't define variables of multiple types on the same line.
Thanks for the help what did the semi colon after string name do? did it initialize the first action of the program? Why did the comma after enter name differ from enter name.
Thanks for the help.
Peter
A semi colon terminates a line. Actual new lines are mainly for readability purposes. For example, you could do this:

 
string name; int ageInYears, ageDiff; // etc 


But the above makes it harder to read.

You can set declarations of the same type apart using commas, as is done above with int. It is equivalent to this:

1
2
3
int ageInyears;
int ageDiff;
// etc. 
Topic archived. No new replies allowed.