Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Thing v.2
// 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 water; getline (cin,water); cout << water; cout << water << endl << "So that's it!" << endl; cout << "Thanks!" << endl; } } else if (q == 'n') { cout << endl << "You should learn a language!" << endl; abort(); } return 0; }
run
|
edit
|
history
|
help
0
Hangman
du
VS struct_member_name
hangman
Matrix_1
iota_30-Seconds-of-C++
Fibonacci stairs
multiply linked list numbers
#8
Sorting algorithm comparison