+ 1
Just I try insert "cin". Please check for my code it right or wrong? (I'm try to learn by my self.) / (Thank a lot for help.) ^^
#include <iostream> using namespace std; int main() { int age = 42; cin>>age; if (age == 16) { cout <<"Too young"; } if (age == 42) { cout << "Adult"; } if (age == 70) { cout << "Senior"; } return 0; }
4 Antworten
+ 2
And what is the question?
+ 2
The code is not wrong. The question is what you would like to do?
What will happen, if your input is different from 16, 42 or 70?
0
I'm sorry, I'm forget write the question.
0
Ha Ha Ha! I don't know master Kenobi, I copy code from c++ tutorial and try insert "cin" for key the number on tutorial code, I want to know the code is compiler?
I just padawan for c++ program, and I learning the c++ programing on first day,
(I live in Thailand and I speak English just a little bit, if I use English wrong word, I'm so sorry for my stupid.)