944,116 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 4869
  • C++ RSS
Jan 14th, 2006
0

Using C++ OOP class.....

Expand Post »
:!: The Question is like this...
About: Subject registration system.
The lecture want
1. Name, Matric Number, Cumulative Grade Percentage Average (CGPA)
CGPA........A=4.0,A-=3.7,B+=3.3,B=3.0,B-=3.7,C+=3.33,C=2.0, F=0.
Name, Matric No,CGPA key in by user. So no need to worried.
2.Condition for CGPA
if CGPA<2.0, can apply up to 18credit hours
if CGPA>2.0, can apply more then 18 credit hours
3.with this condition
the user will select the courses they wan to apply
4. After selected, The program will print out all the selected course that their are entered. [this part i Quite headache]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
THis is my source code:
(i got problem at the last part-print out the staff. Any idea to solve it. Thank )
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#include <iostream.h>
#include <cstring>

class subject{
private:
char *name;
char *matric;
int cgpa;
char sub[14][100];
public:
subject(char * =" ",char * =" ",int=0);
~subject(){}
void setData(char * =" ",char * =" ",int=0);
void select();
void print();
};

subject::subject(char *temp1,char *temp2,int c)
{
name=new char [];
strcpy(name,temp1);
matric=new char[];
strcpy(matric,temp2);
cgpa=c;
sub[14][100]={
"GXEX1401 Kursus Kemahiran Maklumat", "1",
"GXEX1403 Titas Kertas 2","2",
"WRES1103 Rekabentuk Digital","3",
"WRES1201 Senibina Sistem Komputer", "3",
"WRES2101 Internet & Intranet", "3",
"WXES1111 Prinsip Pengaturcaraan Berorientasikan Objek","3",
"WXES1112 Matematik Pengkomputeran 1","3"}
}

void subject::setData(char *temp1,char *temp2,int c)
{
name=new char [];
strcpy(name,temp1);
matric=new char[];
strcpy(matric,temp2);
cgpa=c;
sub[14][100]={
"GXEX1401 Kursus Kemahiran Maklumat", "1",
"GXEX1403 Titas Kertas 2","2",
"WRES1103 Rekabentuk Digital","3",
"WRES1201 Senibina Sistem Komputer", "3",
"WRES2101 Internet & Intranet", "3",
"WXES1111 Prinsip Pengaturcaraan Berorientasikan Objek","3",
"WXES1112 Matematik Pengkomputeran 1","3"}
}

void subject::select()
{
cout<<"1.GXEX1401 Kursus Kemahiran Maklumat\t1\n"
<<"2.GXEX1403 Titas Kertas 2\t2\n"
<<"3.WRES1103 Rekabentuk Digital\t3\n"
<<"4.WRES1201 Senibina Sistem Komputer\t3\n"
<<"5.WRES2101 Internet & Intranet\t3\n"
<<"6.WXES1111 Prinsip Pengaturcaraan Berorientasikan Objek\t3\n"
<<"7.WXES1112 Matematik Pengkomputeran 1\t3\n";
if (cgpa<=2.0)
{
int n,counter;
cout<<"You can select less than or equal to 18 credits hours:";
cin>>n;
counter=counter-sub[n+1];


}
else
cout<<"You can select more than 18 hours:";

}

void subject::print()
{
}

void main()
{
char n[20],m[10];
double c;
cout<<"Name:";
cin>>n;
cout<<"Matric number:";
cin>>m;
cout<<"CGPA:";
cin>>c;
}

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
This program still not completed. So give me some tips. Thank
This is urgent assignment
Are there have to use string,cstring, array,........or other
I need you quick reply
I am very appreciate it
Thank you :rolleyes:
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
fsloke is offline Offline
6 posts
since Jan 2006
Jan 14th, 2006
2

Re: Using C++ OOP class.....

Think harder.
Team Colleague
Reputation Points: 1135
Solved Threads: 172
Super Senior Demiposter
Rashakil Fol is offline Offline
2,479 posts
since Jun 2005
Jan 15th, 2006
0

Re: Using C++ OOP class.....

Quote originally posted by Rashakil Fol ...
Think harder.
I already think it hard la....................
Going to crazy........................
:eek:
I want to die............................
Reputation Points: 10
Solved Threads: 0
Newbie Poster
fsloke is offline Offline
6 posts
since Jan 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Help help.................
Next Thread in C++ Forum Timeline: The C++ LINKED LIST





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC