Answer to Question #55289 in C++ for Charles
2015-10-03T22:33:02-04:00
Can you guys give me 4 programs using while loop?
1
2015-11-13T05:35:55-0500
include <iostream> using namespace std; int main() { string s; while (cin>>s) cout<<s<<endl; } #include <iostream> using namespace std; int main() { char answer; while (answer!='y') { cout<<"Enter number: "; int i; cin>>i; for (int j=1;j<=i;j++) cout<<j<<" "<<j*j<<" "<<j*j*j<<endl; cout<<"Exit(y/n)?"; cin>>answer; } } #include <iostream> using namespace std; int main() { int i=0,j=0; cout<<"Enter number: "; cin>>i; while (j!=i) { cout<<++j<<endl; } } #include <iostream> using namespace std; int main() { string str; char c; while (cin.peek()!='\n') { scanf("%c",&c); if (c!=' ') str+=c; } cout<<str<<endl; }
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS !
Learn more about our help with Assignments:
C++
Comments
Dear Customer, please accept our apologies for this inaccuracy. The answer is edited now, so please check an updated version. Thank you!
Leave a comment