write a program that asks the user; | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

write a program that asks the user;

"do you want to use this program?(y/n)" if the user says yes,then the program asks "are you really sure you want to use this program?"(y/n) if the user says "n" it terminates,otherwise,it prints again the message, are you really really sure you want to use this program?(y,n), and so on every time adding "really"

11th Oct 2019, 2:31 AM
Paul Githinji
Paul Githinji - avatar
1 Answer
0
#include<string> #include<iostream> using namespace std; int main() { string c="do you want to use this program?(y/n)"; cout<<c; cin>>c; if (c=="y"){ cout<<"okay"; } else{ string first="are you "; string second="really "; string third="sure you do not want to use this program?(y/n)"; string full=first+second+third; while(true){ cout<<full; cin>>full; if (full=="n"){ break; } else{ second+="really "; full=first+second+third; } } } return 0; }
7th Sep 2021, 6:45 AM
Magena Acharia
Magena Acharia - avatar