cout<<" Enter the name of the test subject \n";
cin>>name;
cout<<" What is the age of"<<name<< "\n";
cin>>age;
if (age > 13 && < 19 ) { //if age is greater than 13 and less than 19
cout<<name<<" is a teenager \n";
}
return 0;
}
Thats the code being used in the program. It's basically just a test of the && operator that i was fooling around with since i just learned about it and my coding book told me to write a program using them (im a beginner at this stuff after all). Anyway the program is to just tell you the whether the subject is a child, teenager, adult, or elderly. But for some reason this line of code-
if (age > 13 && < 19 ) {
- is getting an error under the < sign and xcode is portraying to me that it was expecting an expression after it. However that < was part of the actual expression.....
Can someone help me with fixing this and explain why it is happening? It seems to be happening also on all the other statements similar to that with the < operator are getting that error as well (that is the ones in this same program. I dont know if im missing something in the code or i typed it out wrong but if you could figure out whats wrong and explain why its not working or how to fix it, i would greatly appreciate it.
Thanks
- Ryan
Yeah thanks @ thebeathacker, it worked! Annnnnnnd i found out that it printed out what is the age of 0 instead of the actual name. Lol i forgot to use string but instead used int lol! Anywho thanks for the help!
- Ryan