60 469
Assignments Done
98,1%
Successfully Done
In April 2018

Answer to Question #26365 in C++ for albert

Question #26365
By default, output is right-justified in its field. You can left-justify text output using the
manipulator setiosflags(ios::left). (For now, don’t worry about what this new notation means.) Use
this manipulator, along with setw(), to help generate the following output:

Last name First name Street address Town State
-----------------------------------------------------------
Jones Bernard 109 Pine Lane Littletown MI
O’Brian Coleen 42 E. 99th Ave. Bigcity NY
Wong Harry 121-A Alabama St. Lakeville IL
Expert's answer
#include < iostream >
# include <string>
# include<iomanip>
using namespace std;


void main() {


string name[10], sur[10];
double mon[10];
int i=0;
cout<<"Enter names down here:
";
while(true){
cout<<"Enter name: ";
cin.ignore();
getline (cin,name[i],'
');
if (name[i]=="") break;
cout<<"Enter surname: ";
cin.ignore();
getline (cin,sur[i],'
');
cout<<"Enter amount of money: ";
cin>>mon[i];
i++;
}
for (int j=0;j<i;j++){
cout<<setiosflags(ios::left)<<setw(3)<<name[j]<<setw(3)<<" "<<sur[j]<<setw(3)<<" "<<mon[j]<<endl;
}


system("PAUSE");
}

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

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions