0
I wrote this using devc++ and it ran properly on windws but when i ran it using solo learn it skipped some of the stages, help
int main() { cout << "Hello my name is Ai what's yours?\n"; cout << "Name:"; string name; cin >> name; cout << "Hello " << name << " How many years old are you?" << "\n"; int age; cin >> age; if (age > 0 ) { cout << "so " << name << " you are " << age << " years old."; } if (age < 0) { cout << "i am pretty sure toddler cant answer my questions"; } } return0; }
3 Answers
+ 6
Code Playground is an online compiler, meaning that separate inputs needs to be all mashed up into one and sent to the compiler. It doesn't work like a console.
Bottom line, it's not your problem.
But ffs, please ditch \n and use endl.
Declare all variables at the beginning of the program instead of declaring them right before you need them.
And I believe even toddlers start from the age of 0 and not below that...
0
thanks for the help