[ create a new paste ] login | about

Link: http://codepad.org/yRnhwZAV    [ raw code | output | fork ]

C, pasted on Aug 13:
#include <iostream>
#include <iomanip>
using namespace std;
class student
{    
    private:
    char name [40];
    float m,p,c,e,cs,sum,avg;
    public:
    void getData (void);
    void display (void);
};
void student :: getData (void)
{
    cout<< "enter your name:"<<name ;
    cin>> name;
    cout<< "enter your math marks:"<<m ;
    cin>> m;
    cout<< "enter your phy marks:"<<p ;
    cin>> p;
    cout<< "enter your chem marks:"<<c ;
    cin>> c;
    cout<< "enter your eng marks:"<<e ;
    cin>> e;
    cout<< "enter your csc marks:"<< cs;
    cin>> cs;
    sum= m+p+c+e+cs;
    avg= sum/5;
}
void student :: display (void)
{
    cout<< setw(5)<< "Name:" << setw (5) << name ;
    cout<< setw(5)<< "Maths:" << setw (5) << m ;
    cout<< setw(5)<< "Physics:" << setw (5) << p ;
    cout<< setw(5)<< "Chemistry:" << setw (5) << c ;
    cout<< setw(5)<< "English:" << setw (5) << e ;
    cout<< setw(5)<< "Computer Science:" << setw (5) << cs ;
    cout<< setw(5)<< "Total marks:" << setw (5) << sum ;
    cout<< setw(5)<< "Average marks:" << setw (5) << avg ;
}
int main()
{
    student s;
    s.getData();
    s.display();
    return 0;
}


Output:
1
2
3
4
5
6
7
8
9
10
11
12
Line 19: error: iostream: No such file or directory
Line 18: error: iomanip: No such file or directory
Line 3: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'namespace'
Line 4: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'student'
Line 13: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
Line 30: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
In function 'main':
Line 43: error: 'student' undeclared (first use in this function)
Line 43: error: (Each undeclared identifier is reported only once
Line 43: error: for each function it appears in.)
Line 43: error: expected ';' before 's'
Line 44: error: 's' undeclared (first use in this function)


Create a new paste based on this one


Comments: