Kindly Help me with the ERRORS!!

This is a discussion on Kindly Help me with the ERRORS!! within the C++ Programming forums, part of the General Programming Boards category; Code: #include<iostream.h> #include<conio.h> #include<string.h> class grade { char subject[20]; int marks; public: void setmarks() { cout<<"Enter marks:"; cin>>marks; } int ...

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    112

    Kindly Help me with the ERRORS!!

    Code:
    
    #include<iostream.h>
    #include<conio.h>
    #include<string.h>
    class grade
    {
    char subject[20];
    int marks;
    
    public:
    
    void setmarks()
    {
    cout<<"Enter marks:";
    cin>>marks;
    }
    
    int getmarks()
    {
    return marks;
    }
    
    void setsubject(char t[20])
    {
    strcpy(subject,t);
    }
    
    char* getsubject()
    {
    return subject;
    }
    
    char calcgrade()
    { char g;
    if (marks<50)
    	g='F';
    else
    	g='A';
    return g;
    }
    
    void printgrade()
    {
    cout<<"Subject is:"<<subject<<"Marks are:"<<marks<<"Grade is:"<<calcgrade();
    }
    };
    
    class student
    {
    char name[20];
    grade a[5];
    
    public:
    
    void setname(char p[20])
    {
    	strcpy(name,p);
    }
    char* getname()
    {
    	return name;
    }
    
    void insertmarks()
    {
    	for (int i=0; i<5; i++)
    	a[i];
    }
    
    int getresult()
    {
    	for (int i=0; i<5; i++)
    	total=total+a[i];
    }
    
    void getreport()
    {
    	cout<<"Name is :"<<name;
    	for (int i=0; i<5; i++)
    	{
    	cout<<"Marks of respective subjects:"<<a[i];
    	}
    	cout<<"Total marks are"<<getresult();
    
    }
    };

  2. #2
    Registered User
    Join Date
    Mar 2009
    Posts
    112
    This program is an example of composition,, !!

  3. #3
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,301
    We would, but you didn't tell us what the errors are!
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. global namespace errors
    By stubaan in forum C++ Programming
    Replies: 9
    Last Post: 04-02-2008, 03:11 PM
  2. Ten Errors
    By AverageSoftware in forum Contests Board
    Replies: 0
    Last Post: 07-20-2007, 10:50 AM
  3. Winsock compilation errors
    By jmd15 in forum Networking/Device Communication
    Replies: 2
    Last Post: 08-03-2005, 08:00 AM
  4. Unknown Errors in simple program
    By neandrake in forum C++ Programming
    Replies: 16
    Last Post: 04-06-2004, 02:57 PM
  5. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 04:44 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21