Start New Discussion within our Software Development Community

can anyone tell me where is my problem ???
i cannot debug this program.

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

#include<iostream>
#include<string>
using namespace std;

class student
{
private :
    string name;
    int id;
    float cgpa;

public :
    void setName(string na);
    void setID(int number);
    void setCGPA(float result);
    string getName();
    int getID();
    float getCGPA();
    void display();
};

void student::setName(string na)
{ name = na; }

void student::setID(int number)
{ id = number; }

void student::setCGPA(float result)
{ cgpa = result; }

string student::getName()
{ return name; }

int student::getID()
{ return id; }

float student :: getCGPA()
{ return cgpa; }

void student:: display()
{
    cout<<"Name : "<<name
        <<"\nID : "<<id
        <<"\nCGPA : "<<cgpa<<endl;
}


student::student()
{
    name = "xxx";
    id = 0;
    cgpa = 1;
}




int main()
{
    student stuA;
    stuA.display();


    system("pause");

    return 0;
}

Define & declare the constructor within class.

public :
    student()
    {
        name = "xxx";
        id = 0;
        cgpa = 1;
    }
    void setName(string na);
    .....
    ....
This question has already been answered. Start a new discussion instead.