Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Thing
// input testing #include <iostream> #include <string> using namespace std; int main () { int x; cin >> x; cout << "The value you entered was: "; cout << x << endl; char y; cout << "Is this correct?\nType Y or N to continue. \n"; cin >> y; if (y == 'y') { cout << "You said: " << y << "es" << endl; cout << "So your value was: " << x << endl; cout << "And double this value is: \n"; cout << x*2 << "\nAnd " << x << " multiplied by itself is: \n"; cout << x*x; } else if (y == 'n') { cout << "You said: " << y << "o" << endl; cout << "Please restart the program"; abort(); } string name; cout << "\nNow, what is your name?" << endl; cin >> name; cout << "Hello " << name << "." << endl; string age; cout << "And how old are you?" << endl; cin >> age; cout << "So you are " << age << " years old. \n"; cout << name << ", do you know any foreign languages?"; char q; cin >> q; if (q == 'y') { cout << "Good! \nDo you know either of these two languages?" << endl; cout << "Japanese or Spanish"; cout << endl << "Type a lowercase j for Japanese, or a lowercase s for Spanish \n"; char w; cin >> w; if (w == 'j') { cout << "What do you know?" << endl; cout << "Do you know how to say 'Good Morning' in Japanese?" << endl; string greet; cin >> greet; cout << greet; cout << endl << "Nice!" << endl << "How about that in kana?" << endl; string kana; cin >> kana; cout << kana; cout << endl << "Cool!"; } else if (w == 's') { cout << endl << "So you know Spanish?" << endl; cout << "Can you say 'Can I have water, please?'" << endl; string spanish; cin >> spanish; cout << spanish; cout << "So it's" << " " << spanish << endl; cout << "Thanks!" << endl; } } else if (q == 'n') { cout << endl << "You should learn a language!" << endl; abort(); } return 0; }
run
|
edit
|
history
|
help
0
SFINAE with std::enable_if
multiplie linked list numbers
Not Common Numbers
hangman
problem_solution5
Zero
VC typeid example
map_file_mangling
Error defining lambda inside namespace
<string> Indirect include of <errno.h> with VSC++