SlideShare a Scribd company logo
1 of 1
Download to read offline
Write a program in C++ to get the Make and Model of the ten cars as structures members by user
and display it on the screen by Function.
Solution
The desired program in c++ with comments are given below:
#include
using namespace std;
//structure decleration
struct car
{
int make;
int model;
};
int main()
{
car obj[10];
//taking input as make and model from user
for(int i = 0; i< 10; i++)
{
cout<<"Enter the make of "<< i+1<<" car"<>obj[i].make;
cout<<"Enter the model of "<< i+1<<" car"<>obj[i].model;
}
//displaying the output on screen
for(int i = 0; i<10; i++)
{
cout<<"Make of "<

More Related Content

More from pristiegee

Fill in the table below for the molecules shown. HCI Ar (atom) Ethane.pdf
Fill in the table below for the molecules shown. HCI Ar (atom) Ethane.pdfFill in the table below for the molecules shown. HCI Ar (atom) Ethane.pdf
Fill in the table below for the molecules shown. HCI Ar (atom) Ethane.pdfpristiegee
 
How financial reporting for public companies has changed since the E.pdf
How financial reporting for public companies has changed since the E.pdfHow financial reporting for public companies has changed since the E.pdf
How financial reporting for public companies has changed since the E.pdfpristiegee
 
Hello everyone,Im working on my fast food order project program..pdf
Hello everyone,Im working on my fast food order project program..pdfHello everyone,Im working on my fast food order project program..pdf
Hello everyone,Im working on my fast food order project program..pdfpristiegee
 
Give the examples of network core devices Give the examples of physic.pdf
Give the examples of network core devices Give the examples of physic.pdfGive the examples of network core devices Give the examples of physic.pdf
Give the examples of network core devices Give the examples of physic.pdfpristiegee
 
For a binary search tree that has a Node with three elements, data, a.pdf
For a binary search tree that has a Node with three elements, data, a.pdfFor a binary search tree that has a Node with three elements, data, a.pdf
For a binary search tree that has a Node with three elements, data, a.pdfpristiegee
 
Find the coordinates of the midpoint of the segment connecting points.pdf
Find the coordinates of the midpoint of the segment connecting points.pdfFind the coordinates of the midpoint of the segment connecting points.pdf
Find the coordinates of the midpoint of the segment connecting points.pdfpristiegee
 
Each student is to prepare a 3-5 page paper on a project on ONE of t.pdf
Each student is to prepare a 3-5 page paper on a project on ONE of t.pdfEach student is to prepare a 3-5 page paper on a project on ONE of t.pdf
Each student is to prepare a 3-5 page paper on a project on ONE of t.pdfpristiegee
 
describe two processes by which evolution can occur. explain why.pdf
describe two processes by which evolution can occur. explain why.pdfdescribe two processes by which evolution can occur. explain why.pdf
describe two processes by which evolution can occur. explain why.pdfpristiegee
 
Develop a structure chart for student asking diploma in university a.pdf
Develop a structure chart for student asking diploma in university a.pdfDevelop a structure chart for student asking diploma in university a.pdf
Develop a structure chart for student asking diploma in university a.pdfpristiegee
 
Consider the following model of a very simple economy. Household savi.pdf
Consider the following model of a very simple economy. Household savi.pdfConsider the following model of a very simple economy. Household savi.pdf
Consider the following model of a very simple economy. Household savi.pdfpristiegee
 
Assembly ProgramngCan the upper 16 bits of the four 32 bit general.pdf
Assembly ProgramngCan the upper 16 bits of the four 32 bit general.pdfAssembly ProgramngCan the upper 16 bits of the four 32 bit general.pdf
Assembly ProgramngCan the upper 16 bits of the four 32 bit general.pdfpristiegee
 
A) How does the ability of the ligand to cross the plasma membrane d.pdf
A) How does the ability of the ligand to cross the plasma membrane d.pdfA) How does the ability of the ligand to cross the plasma membrane d.pdf
A) How does the ability of the ligand to cross the plasma membrane d.pdfpristiegee
 
A T-account is a way of depicting the basic form of an account. what .pdf
A T-account is a way of depicting the basic form of an account. what .pdfA T-account is a way of depicting the basic form of an account. what .pdf
A T-account is a way of depicting the basic form of an account. what .pdfpristiegee
 
A nutrient agar plate labeled 10^-5mL produced 154 colonies after in.pdf
A nutrient agar plate labeled 10^-5mL produced 154 colonies after in.pdfA nutrient agar plate labeled 10^-5mL produced 154 colonies after in.pdf
A nutrient agar plate labeled 10^-5mL produced 154 colonies after in.pdfpristiegee
 
A directory contains the following filesaardvark ferret koala por.pdf
A directory contains the following filesaardvark ferret koala por.pdfA directory contains the following filesaardvark ferret koala por.pdf
A directory contains the following filesaardvark ferret koala por.pdfpristiegee
 
Write a C program using fork() alone to mimic the below below observ.pdf
Write a C program using fork() alone to mimic the below below observ.pdfWrite a C program using fork() alone to mimic the below below observ.pdf
Write a C program using fork() alone to mimic the below below observ.pdfpristiegee
 
Which plane divides the body into right and left halves Wh.pdf
Which plane divides the body into right and left halves Wh.pdfWhich plane divides the body into right and left halves Wh.pdf
Which plane divides the body into right and left halves Wh.pdfpristiegee
 
1.     According to Thomas Nagel, a purely objective conception of r.pdf
1.     According to Thomas Nagel, a purely objective conception of r.pdf1.     According to Thomas Nagel, a purely objective conception of r.pdf
1.     According to Thomas Nagel, a purely objective conception of r.pdfpristiegee
 
Which of the following lists correctly presents levels of organizatio.pdf
Which of the following lists correctly presents levels of organizatio.pdfWhich of the following lists correctly presents levels of organizatio.pdf
Which of the following lists correctly presents levels of organizatio.pdfpristiegee
 
what motivates a workplace bullySolutionWorkplace bullies are.pdf
what motivates a workplace bullySolutionWorkplace bullies are.pdfwhat motivates a workplace bullySolutionWorkplace bullies are.pdf
what motivates a workplace bullySolutionWorkplace bullies are.pdfpristiegee
 

More from pristiegee (20)

Fill in the table below for the molecules shown. HCI Ar (atom) Ethane.pdf
Fill in the table below for the molecules shown. HCI Ar (atom) Ethane.pdfFill in the table below for the molecules shown. HCI Ar (atom) Ethane.pdf
Fill in the table below for the molecules shown. HCI Ar (atom) Ethane.pdf
 
How financial reporting for public companies has changed since the E.pdf
How financial reporting for public companies has changed since the E.pdfHow financial reporting for public companies has changed since the E.pdf
How financial reporting for public companies has changed since the E.pdf
 
Hello everyone,Im working on my fast food order project program..pdf
Hello everyone,Im working on my fast food order project program..pdfHello everyone,Im working on my fast food order project program..pdf
Hello everyone,Im working on my fast food order project program..pdf
 
Give the examples of network core devices Give the examples of physic.pdf
Give the examples of network core devices Give the examples of physic.pdfGive the examples of network core devices Give the examples of physic.pdf
Give the examples of network core devices Give the examples of physic.pdf
 
For a binary search tree that has a Node with three elements, data, a.pdf
For a binary search tree that has a Node with three elements, data, a.pdfFor a binary search tree that has a Node with three elements, data, a.pdf
For a binary search tree that has a Node with three elements, data, a.pdf
 
Find the coordinates of the midpoint of the segment connecting points.pdf
Find the coordinates of the midpoint of the segment connecting points.pdfFind the coordinates of the midpoint of the segment connecting points.pdf
Find the coordinates of the midpoint of the segment connecting points.pdf
 
Each student is to prepare a 3-5 page paper on a project on ONE of t.pdf
Each student is to prepare a 3-5 page paper on a project on ONE of t.pdfEach student is to prepare a 3-5 page paper on a project on ONE of t.pdf
Each student is to prepare a 3-5 page paper on a project on ONE of t.pdf
 
describe two processes by which evolution can occur. explain why.pdf
describe two processes by which evolution can occur. explain why.pdfdescribe two processes by which evolution can occur. explain why.pdf
describe two processes by which evolution can occur. explain why.pdf
 
Develop a structure chart for student asking diploma in university a.pdf
Develop a structure chart for student asking diploma in university a.pdfDevelop a structure chart for student asking diploma in university a.pdf
Develop a structure chart for student asking diploma in university a.pdf
 
Consider the following model of a very simple economy. Household savi.pdf
Consider the following model of a very simple economy. Household savi.pdfConsider the following model of a very simple economy. Household savi.pdf
Consider the following model of a very simple economy. Household savi.pdf
 
Assembly ProgramngCan the upper 16 bits of the four 32 bit general.pdf
Assembly ProgramngCan the upper 16 bits of the four 32 bit general.pdfAssembly ProgramngCan the upper 16 bits of the four 32 bit general.pdf
Assembly ProgramngCan the upper 16 bits of the four 32 bit general.pdf
 
A) How does the ability of the ligand to cross the plasma membrane d.pdf
A) How does the ability of the ligand to cross the plasma membrane d.pdfA) How does the ability of the ligand to cross the plasma membrane d.pdf
A) How does the ability of the ligand to cross the plasma membrane d.pdf
 
A T-account is a way of depicting the basic form of an account. what .pdf
A T-account is a way of depicting the basic form of an account. what .pdfA T-account is a way of depicting the basic form of an account. what .pdf
A T-account is a way of depicting the basic form of an account. what .pdf
 
A nutrient agar plate labeled 10^-5mL produced 154 colonies after in.pdf
A nutrient agar plate labeled 10^-5mL produced 154 colonies after in.pdfA nutrient agar plate labeled 10^-5mL produced 154 colonies after in.pdf
A nutrient agar plate labeled 10^-5mL produced 154 colonies after in.pdf
 
A directory contains the following filesaardvark ferret koala por.pdf
A directory contains the following filesaardvark ferret koala por.pdfA directory contains the following filesaardvark ferret koala por.pdf
A directory contains the following filesaardvark ferret koala por.pdf
 
Write a C program using fork() alone to mimic the below below observ.pdf
Write a C program using fork() alone to mimic the below below observ.pdfWrite a C program using fork() alone to mimic the below below observ.pdf
Write a C program using fork() alone to mimic the below below observ.pdf
 
Which plane divides the body into right and left halves Wh.pdf
Which plane divides the body into right and left halves Wh.pdfWhich plane divides the body into right and left halves Wh.pdf
Which plane divides the body into right and left halves Wh.pdf
 
1.     According to Thomas Nagel, a purely objective conception of r.pdf
1.     According to Thomas Nagel, a purely objective conception of r.pdf1.     According to Thomas Nagel, a purely objective conception of r.pdf
1.     According to Thomas Nagel, a purely objective conception of r.pdf
 
Which of the following lists correctly presents levels of organizatio.pdf
Which of the following lists correctly presents levels of organizatio.pdfWhich of the following lists correctly presents levels of organizatio.pdf
Which of the following lists correctly presents levels of organizatio.pdf
 
what motivates a workplace bullySolutionWorkplace bullies are.pdf
what motivates a workplace bullySolutionWorkplace bullies are.pdfwhat motivates a workplace bullySolutionWorkplace bullies are.pdf
what motivates a workplace bullySolutionWorkplace bullies are.pdf
 

Recently uploaded

TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdfssuserdda66b
 

Recently uploaded (20)

TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 

Write a program in C++ to get the Make and Model of the ten cars as .pdf

  • 1. Write a program in C++ to get the Make and Model of the ten cars as structures members by user and display it on the screen by Function. Solution The desired program in c++ with comments are given below: #include using namespace std; //structure decleration struct car { int make; int model; }; int main() { car obj[10]; //taking input as make and model from user for(int i = 0; i< 10; i++) { cout<<"Enter the make of "<< i+1<<" car"<>obj[i].make; cout<<"Enter the model of "<< i+1<<" car"<>obj[i].model; } //displaying the output on screen for(int i = 0; i<10; i++) { cout<<"Make of "<