#include #include #include using namespace std; // structure struct Hat { string brand; string color; float price; }; // Customer structure struct Customer { string fullName ; int age ; Hat hat; // Hat structure (nested in Customer) }; int main() { // declare 5 variables of Customer Customer customer_1,customer_2,customer_3,customer_4,customer_5; cout<<"Welcome to Hats For U!\n"; cout<<"Customer 1\n"; cout<<"Enter customer's Full Name: "; getline(cin,customer_1.fullName); cout<<"Enter customer's age: "; cin>>customer_1.age; cout<<"Enter the brand of hat: "; cin>>customer_1.hat.brand; cout<<"Enter the hat color: "; cin>>customer_1.hat.color; cout<<"Enter the hat price(RM): "; cin>>customer_1.hat.price; cout<<"Hat 2\n"; cout<<"Enter customer's Full Name: "; getline(cin,customer_2.fullName); getline(cin,customer_2.fullName); cout<<"Enter customer's age: "; cin>>customer_2.age; cout<<"Enter the brand of hat: "; cin>>customer_2.hat.brand; cout<<"Enter the hat color: "; cin>>customer_2.hat.color; cout<<"Enter the hat price(RM): "; cin>>customer_2.hat.price; cout<<"Hat 3\n"; cout<<"Enter customer's Full Name: "; getline(cin,customer_3.fullName); getline(cin,customer_3.fullName); cout<<"Enter customer's age: "; cin>>customer_3.age; cout<<"Enter the brand of hat: "; cin>>customer_3.hat.brand; cout<<"Enter the hat color: "; cin>>customer_3.hat.color; cout<<"Enter the hat price(RM): "; cin>>customer_3.hat.price; cout<<"Hat 4\n"; cout<<"Enter customer's Full Name: "; getline(cin,customer_4.fullName); getline(cin,customer_4.fullName); cout<<"Enter customer's age: "; cin>>customer_4.age; cout<<"Enter the brand of hat: "; cin>>customer_4.hat.brand; cout<<"Enter the hat color: "; cin>>customer_4.hat.color; cout<<"Enter the hat price(RM): "; cin>>customer_4.hat.price; cout<<"Hat 5\n"; cout<<"Enter customer's Full Name: "; getline(cin,customer_5.fullName); getline(cin,customer_5.fullName); cout<<"Enter customer's age: "; cin>>customer_5.age; cout<<"Enter the brand of hat: "; cin>>customer_5.hat.brand; cout<<"Enter the hat color: "; cin>>customer_5.hat.color; cout<<"Enter the hat price(RM): "; cin>>customer_5.hat.price; cout<<"\n\nRECORD OF HATS \n"; cout<<"------------------------------------------------------------------------------\n"; cout<

Microsoft Windows 10 Comprehensive 2019
1st Edition
ISBN:9780357392607
Author:FREUND
Publisher:FREUND
Chapter8: Mastering Digital Media
Section: Chapter Questions
Problem 9AYK
icon
Related questions
Question

#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
// structure
struct Hat
{
string brand;
string color;
float price;
};
// Customer structure
struct Customer
{
string fullName ;
int age ;
Hat hat; // Hat structure (nested in Customer)
};
int main()
{
// declare 5 variables of Customer
Customer customer_1,customer_2,customer_3,customer_4,customer_5;

cout<<"Welcome to Hats For U!\n";
cout<<"Customer 1\n";
cout<<"Enter customer's Full Name: ";
getline(cin,customer_1.fullName);
cout<<"Enter customer's age: ";
cin>>customer_1.age;
cout<<"Enter the brand of hat: ";
cin>>customer_1.hat.brand;
cout<<"Enter the hat color: ";
cin>>customer_1.hat.color;
cout<<"Enter the hat price(RM): ";
cin>>customer_1.hat.price;

cout<<"Hat 2\n";
cout<<"Enter customer's Full Name: ";
getline(cin,customer_2.fullName);
getline(cin,customer_2.fullName);
cout<<"Enter customer's age: ";
cin>>customer_2.age;
cout<<"Enter the brand of hat: ";
cin>>customer_2.hat.brand;
cout<<"Enter the hat color: ";
cin>>customer_2.hat.color;
cout<<"Enter the hat price(RM): ";
cin>>customer_2.hat.price;

cout<<"Hat 3\n";
cout<<"Enter customer's Full Name: ";
getline(cin,customer_3.fullName);
getline(cin,customer_3.fullName);
cout<<"Enter customer's age: ";
cin>>customer_3.age;
cout<<"Enter the brand of hat: ";
cin>>customer_3.hat.brand;
cout<<"Enter the hat color: ";
cin>>customer_3.hat.color;
cout<<"Enter the hat price(RM): ";
cin>>customer_3.hat.price;

cout<<"Hat 4\n";
cout<<"Enter customer's Full Name: ";
getline(cin,customer_4.fullName);
getline(cin,customer_4.fullName);
cout<<"Enter customer's age: ";
cin>>customer_4.age;
cout<<"Enter the brand of hat: ";
cin>>customer_4.hat.brand;
cout<<"Enter the hat color: ";
cin>>customer_4.hat.color;
cout<<"Enter the hat price(RM): ";
cin>>customer_4.hat.price;

cout<<"Hat 5\n";
cout<<"Enter customer's Full Name: ";
getline(cin,customer_5.fullName);
getline(cin,customer_5.fullName);
cout<<"Enter customer's age: ";
cin>>customer_5.age;
cout<<"Enter the brand of hat: ";
cin>>customer_5.hat.brand;
cout<<"Enter the hat color: ";
cin>>customer_5.hat.color;
cout<<"Enter the hat price(RM): ";
cin>>customer_5.hat.price;

cout<<"\n\nRECORD OF HATS \n";
cout<<"------------------------------------------------------------------------------\n";
cout<<setw(20)<<left<<"Full Name"<<setw(20)<<left<<"Age"<<setw(20)<<left<<"Brand"<<setw(20)<<left<<"Color"<<setw(20)<<left<<"Price(RM)\n";
cout<<"------------------------------------------------------------------------------\n";

cout<<setw(20)<<left<<customer_1.fullName;
cout<<setw(20)<<left<<customer_1.age;
cout<<setw(20)<<left<<customer_1.hat.brand;
cout<<setw(20)<<left<<customer_1.hat.color;
cout<<setw(20)<<left<<customer_1.hat.price;

cout<<setw(20)<<left<<customer_2.fullName;
cout<<setw(20)<<left<<customer_2.age;
cout<<setw(20)<<left<<customer_2.hat.brand;
cout<<setw(20)<<left<<customer_2.hat.color;
cout<<setw(20)<<left<<customer_2.hat.price;

cout<<setw(20)<<left<<customer_3.fullName;
cout<<setw(20)<<left<<customer_3.age;
cout<<setw(20)<<left<<customer_3.hat.brand;
cout<<setw(20)<<left<<customer_3.hat.color;
cout<<setw(20)<<left<<customer_3.hat.price;

cout<<setw(20)<<left<<customer_4.fullName;
cout<<setw(20)<<left<<customer_4.age;
cout<<setw(20)<<left<<customer_4.hat.brand;
cout<<setw(20)<<left<<customer_4.hat.color;
cout<<setw(20)<<left<<customer_4.hat.price;

cout<<setw(20)<<left<<customer_5.fullName;
cout<<setw(20)<<left<<customer_5.age;
cout<<setw(20)<<left<<customer_5.hat.brand;
cout<<setw(20)<<left<<customer_5.hat.color;
cout<<setw(20)<<left<<customer_5.hat.price;
return 0;
}

Above is my code, can you please help me fix the table so that it is even and aligned with each other?

Hat 5
Enter customer's Full Name: William wash
Enter customer's age: 33
Enter the brand of hat: iphone
Enter the hat color: green
Enter the hat price (RM): 644
RECORD OF HATS
Full Name
Age
Brand
Color
Price (RM)
John Mayer
23
apple
black
190
Divya Dileep
23
MI
black
209
Dileep Maradana
21
Iphone
Wh
ite
390
Erica WIlson
23
branded
white
394
Transcribed Image Text:Hat 5 Enter customer's Full Name: William wash Enter customer's age: 33 Enter the brand of hat: iphone Enter the hat color: green Enter the hat price (RM): 644 RECORD OF HATS Full Name Age Brand Color Price (RM) John Mayer 23 apple black 190 Divya Dileep 23 MI black 209 Dileep Maradana 21 Iphone Wh ite 390 Erica WIlson 23 branded white 394
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Windows 10 Comprehensive 2019
Microsoft Windows 10 Comprehensive 2019
Computer Science
ISBN:
9780357392607
Author:
FREUND
Publisher:
Cengage