We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More


Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

Correct and Final Solution of Assignment No.3 Of CS201 Due Date 14 Jan 2013 Solved by Waqas Rasheed

+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 4132

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Replies to This Discussion


#include "iostream"
#include "string"
using namespace std;
class VEHICLE{
... private:
char company[20];
char model[20]; 
int year;
int engin;
public:
VEHICLE();

void display();
void get_input();
void set_vehicle(char[],char[],int,int);
void get_comp_mod(char[],char[]);
int get_year(int);
int get_engin(int);

~VEHICLE()
{

cout"Object Deleted"endl;
}

};
VEHICLE::VEHICLE()
{
strcpy(company,"suzuki");
strcpy(model,"cultus");
year = 0;
engin = 0;
}

void VEHICLE::set_vehicle(char comp[],char mod[],int y,int eng)
{
strcpy(company,comp);
strcpy(model,mod);
year = y;
engin = eng;

}
void VEHICLE::get_comp_mod(char comp[],char mod[])
{
strcpy(comp,company);
strcpy(mod,model);

}
int VEHICLE::get_year(int y)
{
return year;

}
int VEHICLE::get_engin(int eng)
{

return engin;
}
void VEHICLE::display()
{
char comp[20];
char mod[20];
int y = 0;
int eng = 0;
get_comp_mod(comp,mod);
cout"Company: "compendl;
coutendl;
cout"Model: "modendl;
coutendl;
cout"Year: "get_year(y)endl;
coutendl;
cout"Engin: "get_engin(eng)endl;
coutendl;

}
void VEHICLE::get_input()
{
char comp[20];
char mod[20];
int y = 0;
int eng = 0;
cout"Please Enter The Name Of Vehicle Maker Company: ";
cin>>comp;
coutendl;
cout"Please Enter the Model Of The Vehicle: ";
cin>>mod;
coutendl;
cout"Please Enter The Year Of Registration: ";
cin>>y;
coutendl;
cout"Please Enter The Engin Capacity: ";
cin>>eng;
coutendl;
set_vehicle(comp,mod,y,eng);


}

int main()
{
int vnum = 0;
VEHICLE* vehiptr;
cout"Please enter the number of vehicle: ";
cin>>vnum;
coutendl;
vehiptr = new VEHICLE[vnum];

for(int a=0;a<vnum;a++)
{
cout"VEHICLE "a+1endl;
coutendl;
vehiptr[a].get_input();

}
for(int i =0;i<vnum;i++)
{
cout"VEHICLE ["i+1']'endl;
coutendl;
vehiptr[i].display();

}
delete [] vehiptr;
system("pause");

}

      Fully Correct Solution of CS201 100%

#include<iostream.h>
#include<string.h>
using namespace std;
//Defining classes
class VEHICLE{
private:
char maker[20];
char model[20];
int year;
int engine;
public:
VEHICLE();
void display();
void get_input();
void set_vehicle(char[],char[],int,int);
void get_comp_mod(char[],char[]);
int get_year(int);
int get_engine(int);

~VEHICLE()
{
cout"Object Deleted"endl;
}
};
VEHICLE::VEHICLE()
{
strcpy(maker,"Nissan");
strcpy(model,"Sunny");
year=0;
engine=0;
}
void VEHICLE::set_vehicle(char comp[],char mod[],int y,int eng)
{
strcpy(maker,comp);
strcpy(model,mod);
year=y;
engine=eng;
}
void VEHICLE::get_comp_mod(char comp[],char mod[])
{
strcpy(comp,maker);
strcpy(mod,model);
}
int VEHICLE::get_year(int y)
{
return year;
}
void VEHICLE::display()
{
char comp[20];
char mod[20];
int y=0;
int eng=0;
get_comp_mod(comp,mod);
cout"Company:mod"endl;
coutendl;
cout"Model:comp"endl;
coutendl;
cout"Year:get_year(y)"endl;
coutendl;
cout"Engine:get_engine(eng)"endl;
coutendl;
}
void VEHICLE::get_input()
{
char comp[20];
char mod[20];
int y=0;
int eng=0;
cout"Please Enter The Name Of Vehicle Maker Company:";
cin>>comp;
coutendl;
cout"Please Enter the Model Of The Vehicle:";
cin>>mod;
coutendl;
cout"Please Enter The Year Of Registration:";
cin>>y;
coutendl;
cout"Please Enter The Engine Capacity:";
cin>>eng;
coutendl;
set_vehicle(comp,mod,y,eng);
}
int main()
{
int vnum=0;
VEHICLE*vehiptr;
cout"Please Enter The Number Of Vehicle:";
cin>>vnum;
coutendl;
vehiptr=new VEHICLE[vnum];
for(int a=0;a<vnum;a++)
{
cout"VEHICLE[a+1]"endl;
coutendl;
vehiptr[a].get_input();
}
for(int i=0;i<vnum;i++)
{
cout"VEHICLE[i+1]"endl;
coutendl;
vehiptr[i].display();
}
delete []vehiptr;
system("pause");
}

CS201 Introduction to Programming Assignment No. 03 Solution

/****************** Assignment No. 3 : Solution **********************/
//Assignment No. 03
//Semester: Fall 2012
#include <iostream>
#include <string>
using namespace std;
// Defining classes
class VEHICLE{

private:
char maker[20];
char model[20]; 
int year;
int engine;

public:

VEHICLE();

void display();
void get_input();
void set_vehicle(char[],char[],int,int);
void get_comp_mod(char[],char[]);
int get_year(int);
int get_engin(int);

~VEHICLE()
{
cout"Object Deleted"endl;
}

};

VEHICLE::VEHICLE()
{
strcpy(maker,"Nissan");
strcpy(model,"Sunny");
year = 0;
engine = 0;
}

void VEHICLE::set_vehicle(char comp[],char mod[],int y,int eng)
{
strcpy(maker,comp);
strcpy(model,mod);
year = y;
engine = eng;
}

void VEHICLE::get_comp_mod(char comp[],char mod[])
{
strcpy(comp,maker);
strcpy(mod,model);
}

int VEHICLE::get_year(int y)
{
return year;
}

int VEHICLE::get_engin(int eng)
{
return engine;
}

void VEHICLE::display()
{
char comp[20];
char mod[20];
int y = 0;
int eng = 0;
get_comp_mod(comp,mod);
cout"Vehicle Maker: "compendl;
coutendl;
cout"Model: "modendl;
coutendl;
cout"Year: "get_year(y)endl;
coutendl;
cout"Engine capacity in cc: "get_engin(eng)endl;
coutendl;
}

void VEHICLE::get_input()
{
char comp[20];
char mod[20];
int y = 0;
int eng = 0;
cout"Please enter the name of vehicle maker company: ";
cin>>comp;
coutendl;
cout"Please enter the vehicle model: ";
cin>>mod;
coutendl;
cout"Please enter the year of registration: ";
cin>>y;
coutendl;
cout"Please enter engine capacity of the vehicle : ";
cin>>eng;
coutendl;
set_vehicle(comp,mod,y,eng);
}

int main()
{
int vnum = 0;
VEHICLE* vehiptr;
cout"Please enter the number of vehicles: ";
cin>>vnum;
coutendl;
vehiptr = new VEHICLE[vnum];

for(int a=0;a<vnum;a++)
{
cout"VEHICLE "a+1endl;
coutendl;
vehiptr[a].get_input();
}
for(int i =0;i<vnum;i++)
{
cout"VEHICLE" [i+1] endl;
coutendl;
vehiptr[i].display();
}
delete [] vehiptr;
system("pause");
}

CS201 Introduction to Programming Assignment No. 03 Solution With out strings 

//Assignment No. 03
//Semester: Fall 2012
// This solution is witout Strings
#include <iostream>
using namespace std;
class VEHICLE{
private:
//Taking Veriables
char Company[20];
char Model[20];
int Year;
int Engine;
public:
VEHICLE();

void display();
void get_input();
void set_vehicle(char[],char[],int,int);
void get_comp_mod(char[],char[]);
int get_year(int);
int get_engine(int);

~VEHICLE()
{

cout"Object Deleted"endl;
}

};
VEHICLE::VEHICLE()
{
strcpy(Company,"suzuki");
strcpy(Model,"cultus");
Year = 0;
Engine = 0;
}

void VEHICLE::set_vehicle(char comp[],char mod[],int y,int eng)
{
strcpy(Company,comp);
strcpy(Model,mod);
Year = y;
Engine = eng;

}
void VEHICLE::get_comp_mod(char comp[],char mod[])
{
strcpy(comp,Company);
strcpy(mod,Model);

}
int VEHICLE::get_year(int y)
{
return Year;

}
int VEHICLE::get_engine(int eng)
{

return Engine;
}
void VEHICLE::display()
{
char comp[20];
char mod[20];
int y = 0;
int eng = 0;
get_comp_mod(comp,mod);
cout"Company: "compendl;
coutendl;
cout"Model: "modendl;
coutendl;
cout"Year: "get_year(y)endl;
coutendl;
cout"Engine: "get_engine(eng)endl;
coutendl;

}
void VEHICLE::get_input()
{
char comp[20];
char mod[20];
int y = 0;
int eng = 0;
cout"Please Enter The Name Of Vehicle Maker Company: ";
cin>>comp;
coutendl;
cout"Please Enter the Model Of The Vehicle: ";
cin>>mod;
coutendl;
cout"Please Enter The Year Of Registration: ";
cin>>y;
coutendl;
cout"Please Enter The Engin Capacity: ";
cin>>eng;
coutendl;
set_vehicle(comp,mod,y,eng);


}

int main()
{
int vnum = 0;
VEHICLE* vehiptr;
cout"Please enter the number of vehicle: ";
cin>>vnum;
coutendl;
vehiptr = new VEHICLE[vnum];

for(int a=0;a<vnum;a++)
{
cout"VEHICLE "a+1endl;
coutendl;
vehiptr[a].get_input();

}
for(int i =0;i<vnum;i++)
{
cout"VEHICLE "i+1endl;
coutendl;
vehiptr[i].display();

}
delete [] vehiptr;
system("pause");
}

Please dont copy it , otherwise you will get zero marks..

Now make some changes like explain each step in your own langaue with slash bars like

for(int i =0;i<vnum;i++)
{
cout"VEHICLE "i+1endl;
coutendl;
vehiptr[i].display();

see this code now convert this code in your language

//using for loop

for(int i =0;i<vnum;i++)
{
// for displaying out put

cout"VEHICLE "i+1endl;
// for end of line

coutendl;
vehiptr[i].display();

if u want to use these code assignment then make changes as above... your assignment will save

if you send same as then u will get surely zero... so plz be aware and be care full

#include span class="GRcorrect">iostream>
#includespan class="GRcorrect">conio.h>
#include<string>
using namespace std;
class vehicle { 
public: //Public Area Defination Of Methods accessable To outside of class
vehicle(string,string,int,int); //First Constructor with 4 parameters
vehicle(); //Simple Constructor without parameters
~vehicle(); //Destructor of class vehicle
string getcom(); //Getter Method For Company Data Member
string getmod(); //Getter Method For Model Data Member
int getyr(); //Getter Method For Year Data Member
int getcap(); //Getter Method For Capacity Data Member
void setcom(string); //Setter Method For Company Data Member
void setmod(string); //Setter Method For Model Data Member
void setyr(int); //Setter Method For Year Data Member
void setcap(int); //Setter Method For Capacity Data Member
void display(); //Method To Display Values Of Class Data Members
void getinput(); //Method To Take Input For 4 Class Data Members;
private: //Private Area of Class Declartion of Data Members Accessable only to Member Methods
string comp ; //Data Member For Company Of Vehicle
string mod; //Data Member For Model Of Vehicle
int yr ; //Data Member For Year Of Vehicle
int cap; //Data Member For Capacity Of Vehicle
}; 
//Defination Area Of Methods Declared in Class 
vehicle::vehicle(string comp,string mod,int yr,int cap){
this->setcom(comp);
this->setmod(mod);
this->setyr(yr);
this->setcap(cap);
};
vehicle::vehicle(){
this->comp="";
this->mod="";
this->yr=0;
this->cap=0;
};
vehicle::~vehicle(){
cout"Destructor called"endl;
}
void vehicle::setcomp(string comp){
this->comp = comp;
};
void vehicle::setmod(string model){
this->mod = model;
};
void vehicle::setyr(int year){
this->yr = year;
};
void vehicle::setcap(int cap){
this->cap = cap;
};
string vehicle::getcomp(){
return this->comp;
};
string vehicle::getmod(){
return this->mod;
};
int vehicle::getyr(){
return this->yr;
};
int vehicle::getcap(){
return this->cap;
};
void vehicle::getinput(){
string company,model;
int year ,cap;
cout"Enter Name Of Vehicle Maker Company : ";
cin>>company;
cout"Enter Vehicle Model : ";
cin>>model;
cout"Enter Year Of Registration : ";
cin>>year;
cout"Enter Capacity Of Engine : ";
cin>>cap;
coutendl;
this->setcomp(company);
this->setmod(model);
this->setyr(year);
this->setcap(cap);
}
void vehicle::display(){
cout"Company: "this->getcomp()endl;
cout"Model: "this->getmod()endl;
cout"Year: "this->getyr()endl;
cout"Capacity:"this->getcap()endlendl;
}
main(){
int numberofvehicle=0; //Variable For Number Of Class Objects
cout"Please Enter Number Of Vehicle "endl; //Take Input For Number Of Class Objects (Number OF Vehicles)
cin>>size;
vehicle *p = new vehicle[numberofvehicle]; // Creating and Initalizing Number Of objects and assigning to pointer of clss type
for(int i=0; i<numberofvehicle; i++){ // Taking Input in all objects from user using the getinput method of class
cout"Vehicle "i+1endlendl;
p[i].getinput();
}
for(int i=0; i<numberofvehicle; i++){ //Displaying The values of All Data Members Of All Objects Of Class
cout"Vehicle "i+1endlendl;
p[i].display();
}
delete []p;
system("PAUSE"); 
}

#include iostream>
#include string>
using namespace std;
class VEHICLE{
private:
char company[20];
char model[20];
int year;
int engin;
public:
VEHICLE();

void display();
void get_input();
void set_vehicle(char[],char[],int,int);
void get_comp_mod(char[],char[]);
int get_year(int);
int get_engin(int);

~VEHICLE()
{

cout"Object Deleted"endl;
}

};
VEHICLE::VEHICLE()
{
strcpy(company,"");
strcpy(model,"");
year = 0;
engin = 0;
}

void VEHICLE::set_vehicle(char comp[],char mod[],int y,int eng)
{
strcpy(company,comp);
strcpy(model,mod);
year = y;
engin = eng;

}
void VEHICLE::get_comp_mod(char comp[],char mod[])
{
strcpy(comp,company);
strcpy(mod,model);

}
int VEHICLE::get_year(int y)
{
return year;

}
int VEHICLE::get_engin(int eng)
{

return engin;
}
void VEHICLE::display()
{
char comp[20];
char mod[20];
int y = 0;
int eng = 0;
get_comp_mod(comp,mod);
cout"Company: "compendl;
coutendl;
cout"Model: "modendl;
coutendl;
cout"Year: "get_year(y)endl;
coutendl;
cout"Engin: "get_engin(eng)endl;
coutendl;

}
void VEHICLE::get_input()
{
char comp[20];
char mod[20];
int y = 0;
int eng = 0;
cout"Please Enter The Name Of Vehicle Maker Company: ";
cin>>comp;
coutendl;
cout"Please Enter the Model Of The Vehicle: ";
cin>>mod;
coutendl;
cout"Please Enter The Year Of Registration: ";
cin>>y;
coutendl;
cout"Please Enter The Engin Capacity: ";
cin>>eng;
coutendl;
set_vehicle(comp,mod,y,eng);


}

int main()
{
    system("cls");
    system("Color 1A");
    
  
cout"\t\t              BSCS 2nd Semester \n\t\t        3rd Assignment Solution File\n";
cout"\tStudent Name:-Sunny Pome Student ID:- BC120200xxxx\n"; 
int vnum = 0;
VEHICLE* vehiptr;
cout"\nPlease enter the number of vehicle:\n ";
cin>>vnum;
coutendl;
vehiptr = new VEHICLE[vnum];

for(int a=0;a<vnum;a++)
{
cout"VEHICLE "a+1endl;
coutendl;
vehiptr[a].get_input();

}
for(int i =0;i<vnum;i++)
{
cout"VEHICLE ["i+1']'endl;
coutendl;
vehiptr[i].display();

}
delete [] vehiptr;
system("pause");

}

Pehle error de raha tha lekn Detructor ko public functions k bad likha h to ab teek kam krta h but... "Object deleted" ka message 2 dafa extra deta he. Yani agr vehicles ki tadad 3 ho to "Object deleted" wala message 5 dafa likha hua ata he end pr. Can you help plz k esa q ho rha he?

Plz check out the Screen shot. Thanks

@Waqas Rasheed: Pehle error de raha tha lekn Detructor ko public functions k bad likha h to ab teek kam krta h but... "Object deleted" ka message 2 dafa extra deta he. Yani agr vehicles ki tadad 3 ho to "Object deleted" wala message 5 dafa likha hua ata he end pr. Can you help plz k esa q ho rha he?
Plz check out the Screen shot. Thanks

Prince send me file.. .i will check .ap ne koe na koe mistake ke hogi...

Thanks Waqas bhai. Problem solve ho gya he. Loop m masla tha.

Thanks for sharing.

bahi jan kindly ap complete code wali assignment send kr dy

RSS

Latest Activity

彡JK彡 ❤️ replied to Asad's discussion انتظار
1 hour ago
afaq posted a discussion
5 hours ago
+ ! ! ! ! ! ! ! ! ! ! dReAm gIrL replied to Zain Kazimi's discussion Self Poetry Dedicated to Nasir Kazimi
6 hours ago
Zain Kazimi posted a discussion
6 hours ago
Azhar Sagar replied to Azhar Sagar's discussion use case diagrams of 4 projects
7 hours ago
+ ! ! ! ! ! ! ! ! STUDENTs +++ liked ♦_"Tooba"_♦'s discussion QUIZ NO 1
7 hours ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion EDU401 Current Mid Term Papers Fall 2019 (14 to 26 December 2019) & All Solved Past Papers, Solved MCQs & Helping Material in the group EDU401 Contemporary Issues and Trends in Education
7 hours ago
+ M.Tariq Malik liked + M.Tariq Malik's discussion EDU401 Current Mid Term Papers Fall 2019 (14 to 26 December 2019) & All Solved Past Papers, Solved MCQs & Helping Material
7 hours ago
+ M.Tariq Malik's 17 discussions were featured
7 hours ago
+ M.Tariq Malik added a discussion to the group EDU401 Contemporary Issues and Trends in Education
7 hours ago
+ M.Tariq Malik liked Zari's discussion cs502 important topics for mid
7 hours ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion EDU305 Current Mid Term Papers Fall 2019 (14 to 26 December 2019) & All Solved Past Papers, Solved MCQs & Helping Material in the group EDU305 Classroom Management
7 hours ago

Today Top Members 

© 2019   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service

.