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: 270

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;
}

1

2

3

4

5

Latest Activity

13 minutes ago
14 minutes ago
42 minutes ago
+ I A liked Zara sanum's discussion cs619 project final deliverable
42 minutes ago
+ I A liked ASIM!!'s discussion جمعہ مبارک
42 minutes ago
+ I A liked + M.Tariq Malik's discussion VU ACADEMIC CALENDAR (FALL 2021)
42 minutes ago
43 minutes ago
43 minutes ago