0% found this document useful (0 votes)
31 views

Assignment No 2 CS101

The document contains an assignment submission for the subject CS101 with student ID 200401796. The code defines a car structure with fields for name, model, vendor, horsepower, price, and owner ID. It then creates a car object, prompts the user to input values for each field, and displays the stored vehicle information.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Assignment No 2 CS101

The document contains an assignment submission for the subject CS101 with student ID 200401796. The code defines a car structure with fields for name, model, vendor, horsepower, price, and owner ID. It then creates a car object, prompts the user to input values for each field, and displays the stored vehicle information.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment No: 2

Student ID: 200401796


Subject: CS101

Code :

#include <iostream>
#include <string>

/* run this program using the console pauser or add your own getch,
system( "pause" ) or input loop */
using namespace std;
struct car
{ string Car_Name;
int Model;
string Vendor;
int Horse_Power;
double Price;
string Owner_ID;

};
int main(int argc, char** argv)

{
car obj;
cout<<" Enter Car Name: ";
cin>>obj.Car_Name;
cout<<" Enter Car Model: ";
cin>>obj.Model;
cout<<" Enter Car Vendor :";
cin>>obj.Vendor;
cout<<" Enter Car Horse Power :";
cin>>obj.Horse_Power;
cout<<" Enter Car Price :";
cin>>obj.Price;
cout<< "Enter Car Ownder_ID :";
cin>>obj.Owner_ID;
cout<<"Values are stored in Car Variable. "<<endl;
cout<< "\nThe stored Vehicle Information is: "<<endl;
cout<<"Name: "<<obj.Car_Name<<endl;
cout<<"Model: "<<obj.Model<<endl;
cout<<"Vendor: "<<obj.Vendor<<endl;
cout<<"Price: "<<obj.Price<<endl;
cout<<"Engine Power:"<<obj.Horse_Power<<endl;
cout<<"Owner ID: "<<obj.Owner_ID;

return 0;
}

You might also like