+ 3
How to make this code work without an error ?
6 Answers
+ 2
#include <iostream>
using namespace std;
int main() {
int age ;
cin >> age ;
if( age < 12){
cout << "You are a child "<< endl ;
}else if( (age >= 12) && (age < 18)){
cout << "You are a teenager " << endl ;
}else if((age >= 18) && (age < 60)){
cout << "You are an adult " << endl ;
}else if( age >= 60 ){
cout << " You are a senior " << endl ;
}
return 0;
}
+ 2
I never knew that switch shouldn't be used with expressions That is all I needed to know , Thanks alot đ
+ 2
You may try something like this instead
https://code.sololearn.com/cjAKzl7ym2JD/?ref=app
+ 2
Oh my god Simba that's so smart thank you
+ 1
I think its simpler like this
+ 1
In switch you mustn't write expression, you only write a constants number after case keyword