| | |
Using C++ OOP class.....
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jan 2006
Posts: 6
Reputation:
Solved Threads: 0
:!: 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:
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
- Why use a Python class? (Python)
- Best GUI toolkit? (Python)
- Python - Importing Data with a Class (Python)
- How to return more than one value from a method? (C#)
- minor problem with vectors and OOP (C++)
- Instantiating class objects?? (C++)
Other Threads in the C++ Forum
- Previous Thread: Help help.................
- Next Thread: The C++ LINKED LIST
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code compile compiler console conversion convert count data delete deploy dll download dynamiccharacterarray email encryption error file format forms fstream function functions game givemetehcodez graph homeworkhelp iamthwee ifstream input int java lib library lines list loop looping loops map math matrix memory newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg search simple sorting spoonfeeding string strings struct temperature template templates text text-file tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets






