+ 1

Following instructions to a point?

I have followed the instructions for question ; Nested if else statements. I have an error within the code playground explaining the following; ..\Playground\ :5:5: error: expected initializer before 'int' int age =18 ^~~ Not entirely sure what I have missed or added without knowing. I need a small touch of advice to help me along. Mitchell.

4th Jun 2018, 4:27 AM
Mitchell Hannemann
Mitchell Hannemann - avatar
3 odpowiedzi
+ 3
Mitchell Hannemann #include <iostream> using namespace std; int main() { int age = 18; if(age > 14){ if(age >= 18){ cout<<"Adult"; } else{ cout<<"Teenager"; } } else{ cout<<"child"; } return 0; }
4th Jun 2018, 5:07 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 2
Give the code, we can understand more better.
4th Jun 2018, 4:28 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 1
#include <iostream> using namespace std; int main() int age = 18 if (age > 14) { if (age >= 18) { cout << "Adult"; } else { cout << "Teenager"; } else { if (age > 0) { cout << "Child"; } else { cout << "Somethings Wrong"; } return 0; }
4th Jun 2018, 4:56 AM
Mitchell Hannemann
Mitchell Hannemann - avatar