+ 3

I need help for my cpp age identifier

I got inspired by sl who had in one of his cpp lessons an example of that so i tried to make something like this but it doesnt show any input how to do it? https://code.sololearn.com/c45jSIx84SoM/?ref=app

18th Jun 2017, 8:18 AM
Petros Papageorgiou
Petros Papageorgiou - avatar
3 Antworten
+ 11
Your 'cin' statement on line 7 inputs to nothing. Replace with: cin >> age; Tbh, the logics seemed kinda off, so I adjusted a few lines. Please take a look: #include <iostream> using namespace std; int main() { int age; cin>> age; if (age > 0) { if (age > 14) { if(age >= 18) { cout << "Adult"; if (age>=100) { cout << " - You are gonna live way too much"; } else if (age>=60){ cout << " - overaged"; } } else { cout << "Teenager"; } } else { cout << "Child"; } } else { cout << "Something's wrong"; } return 0; }
18th Jun 2017, 8:26 AM
Hatsy Rei
Hatsy Rei - avatar
+ 2
write cin>>age as it defines the variable that will take the input
18th Jun 2017, 8:26 AM
Gaurav Garg
Gaurav Garg - avatar
+ 1
also use for >=60 and >=100 in the >14 condition
18th Jun 2017, 8:29 AM
Gaurav Garg
Gaurav Garg - avatar