www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

CS201 Assignment#4 Idea Solution & Discussion

Solution:-

#include <iostream>
using namespace std;
class Student{
private:
string name;
int rollNumber;
string semester;
double cgpa;

public:
Student(string n,int r,string s,double c )
{name=n;
rollNumber=r;
semester=s;
cgpa=c;
}
Student()
{name="";
rollNumber=0;
semester="Summer 2010";
cgpa=4.0;
}

string get_semester()
{return semester;
}
void set_semester(string n)
{semester=n;
}
void set_roll(int n)
{rollNumber=n;
}
int get_roll()
{return rollNumber;
}
void set_name(string n)
{name=n;
}
string get_name()
{return name;
}
void set_cgpa(double n)
{cgpa=n;
}

double get_cgpa()
{return cgpa;
}
void print()
{cout"Student Information\n";
cout"Name: "nameendl;
cout"Roll number: "rollNumberendl;
cout"Semester: "semesterendl;
cout"Current GPA: "cgpaendlendl;
}
};

int main()
{Student a;
Student b("name",2345,"Spring 2010",3.5);
a.print();
b.print();
system("pause");
return 0;
}

Views: 266

Replies to This Discussion

plz jaldey jawab dein . Siraf Allah hey ebadat kay laiq hein .
Problem during compiling .........
is mein kahan correction key zaroorat hay . plz jaldey jawab dein.
Include the header file #include "string" with angle brackets, coz only that file hold this data type and it's definition. OMG! all the member functions declared in this class are working like inline functions. You guys should define all the function explicitly and only their prototypes will be included in the class.Then it will work fine, addios amigoes!
hahhahaahahah.........
Problem of assignment "The system can not find the file specified"
if problem in coding ....... follow the errors and correct
Assignemnt cs201-04 output
Attachments:
han bhai...... iss program mai problem hai...

plz check it...... and upload the update program

aaj last date hai....... :((
Thanks for help in Assigment solution
some one check it plz.. and tell me is it ok.. ??
it gives me result, but i am not shure on this program..

---------------------------------------------------------

#include
using namespace std;
class Student{
private:
string name;
int rollNumber;
string semester;
double cgpa;

public:
Student(string n,int r,string s,double c )
{name=n;
rollNumber=r;
semester=s;
cgpa=c;
}
Student()
{name="";
rollNumber=0;
semester="Summer 2010";
cgpa=4.0;
}

string get_semester()
{return semester;
}
void set_semester(string n)
{semester=n;
}
void set_roll(int n)
{rollNumber=n;
}
int get_roll()
{return rollNumber;
}
void set_name(string n)
{name=n;
}
string get_name()
{return name;
}
void set_cgpa(double n)
{cgpa=n;
}

double get_cgpa()
{return cgpa;
}
void print()
{
cout"Student Information\n";
cout"Kamal Khan "endl;
cout"MC100200133 "endl;
cout"1st "endl;
cout"3.5 "endl;
}
};

int main()
{Student a;
Student b("name",2345,"Spring 2010",3.5);
a.print();
b.print();
system("pause");
return 0;
}
#include
using namespace std;
class Student{
private:
string name;
int rollNumber;
string semester;
double cgpa;

public:
Student(string n,int r,string s,double c )
{name=n;
rollNumber=r;
semester=s;
cgpa=c;
}
Student()
{name="";
rollNumber=0;
semester="Summer 2010";
cgpa=2.3;
}

string get_semester()
{return semester;
}
void set_semester(string n)
{semester=n;
}
void set_roll(int n)
{rollNumber=n;
}
int get_roll()
{return rollNumber;
}
void set_name(string n)
{name=n;
}
string get_name()
{return name;
}
void set_cgpa(double n)
{cgpa=n;
}

double get_cgpa()
{return cgpa;
}
void print()
{cout"Student Information\n";
cout"Name: "nameendl;
cout"Roll number: "rollNumberendl;
cout"Semester: "semesterendl;
cout"Current GPA: "cgpaendl;
}

};

int main()
{Student a;
Student b("name",2345,"Spring 2010",3.5);
a.print();
b.print();
system("pause");
return 0;
}

Top Trends

1

2

3

Laila kabeer

4

5

------------------------------------

Latest Activity

иαвєєℓ αнмє∂ posted discussions
3 hours ago
3 hours ago
иαвєєℓ αнмє∂ gave a gift to 彡ＪＫ彡 ❤️
4 hours ago
4 hours ago
sadia Ch, fancy flower and M Ahmad Raza joined Virtual University of Pakistan
4 hours ago
Mr. Khan! liked Ziddi Queen's discussion ❤HAPPY BIRTHDAY MUSKAN CH❤
5 hours ago
Mr. Khan! liked Zohaib Hassan's discussion ذرا یاد کر۔۔ میرے ہم نفس
5 hours ago
5 hours ago