CS101 ASSIGNMENT
SEMESTER SPRING 2022
Question 1:
Your goal is to develop a C++ program that implements a data
structure named “Car” (userdefined data type) for the given
scenario. Your program must have the following:
1. Define data structure named “Car” with all the above mentioned
attributes.
2. Define appropriate variables within the data structure to store the
above mentioned
attributes.
3. Take input from user for all attributes for a single car as given in
the diagram below and
store them in a “car” variable.
4. Display the Car information on screen as shown in the output
diagram below.
Code:
Subscribe Flourish Learning to get more solutions
#include <iostream>
#include <cstdlib>
using namespace std;
int main(){
char Car_Name[50], Car_Vendor[50], Car_Owner_ID[50];
int Car_Model, Car_Horse_Power, Car_Price;
cout<<"Enter the car Name:";
cin>>Car_Name;
cout<<"Enter the car Model:";
cin>>Car_Model;
cout<<"Enter the car Vendor:";
cin>>Car_Vendor; cout<<"Enter the car Horse Power:";
cin>>Car_Horse_Power; cout<<"Enter the car Price:";
cin>>Car_Price; cout<<"Enter the car Owner ID:";
cin>>Car_Owner_ID; cout<<"Values Āre stored in Car variable:";
cout<<"\n\n";
cout<<"The store Vehicle Information is:"<<endl;
cout<<"Name:"<<Car_Name<<endl;
cout<<"Model:"<<Car_Model<<endl;
cout<<"Vendor:"<<Car_Vendor<<endl;
cout<<"Engin Power:"<<Car_Horse_Power<<endl;
Subscribe Flourish Learning to get more solutions
cout<<"Price:"<<Car_Price<<endl;
cout<<"Onwer ID:"<<Car_Owner_ID<<endl;
}

0 Comments