67 107
Assignments Done
99,3%
Successfully Done
In November 2018

Answer to Question #55289 in C++ for Charles

Question #55289
Can you guys give me 4 programs using while loop?
Expert's answer
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!

Comments

Assignment Expert
13.11.15, 12:35

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

Ask Your question

Submit
Privacy policy Terms and Conditions