#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<
#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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fa5885545-f3ae-4130-b6e2-b82385174675%2F3ef6455e-1668-4d5d-ae88-a97717d7cd17%2Ft9to5jb_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 3 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)