C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 11-11-2009, 10:32 AM   #1
Registered User
 
Join Date: Mar 2009
Posts: 102
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();

}
};
Fatima Rizwan is offline   Reply With Quote
Old 11-11-2009, 10:33 AM   #2
Registered User
 
Join Date: Mar 2009
Posts: 102
This program is an example of composition,, !!
Fatima Rizwan is offline   Reply With Quote
Old 11-11-2009, 12:28 PM   #3
Algorithm Dissector
 
iMalc's Avatar
 
Join Date: Dec 2005
Location: New Zealand
Posts: 2,742
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
iMalc is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

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


All times are GMT -6. The time now is 11:44 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

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