any 1 knw c++? tel me the problem in this programme

lkbee

Member
Aug 28, 2008
709
9
0
#include <iostream>
using namespace std;

class student

{
int marks,grade;

public:

void getmarks();
void GRADE(int);

};

void student::getmarks()
{

cout<<"ENTER MARKS";
cin>>marks;
GRADE(marks);
}

void student::GRADE(int MK)
{

if MK>50

cout<<"pass";
else
cout<<"Fail";

}

int main()

{

getmarks();
GRADE();

return 0;
}
 

v7soft

Member
Aug 23, 2008
618
54
0
#include <iostream>
#include <conio.h>
using namespace std;

class student

{
int marks,grade;

public:

void getmarks();
void GRADE(int);

};

void student::getmarks()
{

cout<<"ENTER MARKS";
cin>>marks;
GRADE(marks);
}

void student::GRADE(int MK)
{

if (MK>50)
{
cout<<"pass";
}
else{
cout<<"Fail";
}

}

int main()

{
student st;
st.getmarks();
getch();

return 0;
}
 

rclakmal

Active member
  • May 8, 2008
    698
    183
    43
    In a galaxy far far away
    Code:
    #include <stdio.h>
    
    #include <iostream>
    using namespace std;
    
    class student
    
    {
    int marks,grade;
    
    public:
    
    int getmarks();
    void GRADE(int x);
    
    };
    
    int student::getmarks()
    {
    
    cout<<"ENTER MARKS";
    cin>>marks;
    return marks;
    }
    
    void student::GRADE(int MK)
    {
    
    if (MK>50)
    
    cout<<"pass";
    else
    cout<<"Fail";
    
    }
    
    int main()
    
    {
        student s;
    s.GRADE(s.getmarks());
    return 0;
    }