-
Content Count
81 -
Joined
-
Last visited
Posts posted by nurul_h5
-
-
[quote name='syahmixp' timestamp='1300778205' post='1065408']
Rasa musykil bila tengok kod...
[code] int a,bil,mark_bm1[ ],mark_bm2[ ],mark_math[ ],mark_science[ ],mark_bi[ ],total_bm1,total_bm2,total_math,total_science,total_bi;[/code]
mungkin sebab array mark_bm1, mark_bm2, dan lain2 diisytihar tanpa saiz.
[/quote]
maybe..........tapi aku nk wt array yg infinate...........ade cara ke??????? -
atucara ni digunakan untuk bagi gred markah n kira purata. ada error dan pada masa yang sama kena masuk polymorphism. camner ek????????aku dh buntu ni.........btw thanks for your help
#include<iostream>
using namespace std;
class Teacher
{
protected:
char stafname[25],stafid[10];
public:
void accept()
{
cout<<"\nEnter your name :"<<endl;
cin>>stafname;
cout<<"\nEnter staffid :"<<endl;
cin>>stafid;
}
};
class Student:public Teacher
{
private:
char Class[3],subject[12],name[25];
int a,bil,mark_bm1[ ],mark_bm2[ ],mark_math[ ],mark_science[ ],mark_bi[ ],total_bm1,total_bm2,total_math,total_science,total_bi;
int average_bm1,average_bm2,average_math,average_science,average_bi;
public:
void Accept();
void display();
};
void Student::Accept()
{
cout<<"\nEnter Class :";
cin>>Class;
cout<<"\nEnter number of student :";
cin>>bil;
for(a=0;a<bil;a++)
{
cout<<"\nEnter student name :";
cin>>name;
cout<<"\nEnter mark for Bahasa Melayu 1 :";
cin>>mark_bm1[a];
cout<<"\nEnter mark for Bahasa Melayu 2 :";
cin>>mark_bm2[a];
cout<<"\nEnter mark for Mathematics :";
cin>>mark_math[a];
cout<<"\nEnter mark for Science:";
cin>>mark_science[a];
cout<<"\nEnter mark for English:";
cin>>mark_bi[a];
total_bm1=total_bm1+mark_bm1[a];
total_bm2=total_bm2+mark_bm2[a];
total_math=total_math+mark_math[a];
total_science=total_science+mark_science[a];
total_bi=total_bi+mark_bi[a];
average_bm1=total_bm1/bil;
average_bm2=total_bm2/bil;
average_math=total_math/bil;
average_science=total_science/bil;
average_bi=total_bi/bil;
}
}
void Student::display()
{
cout<<"\nClass :"<<Class;
cout<<"\t\tBil. Student :"<<bil;
for( a=0;a=bil;a++)
{
if(mark_bm1[a]>=80)
{
cout<<"Name :"<<name;
cout<<"\n\nBahasa Melayu 1 :"<<mark_bm1[a];
cout<<"\tGred A";
}
else if(mark_bm1[a]>59||mark_bm1[a]<80)
{
cout<<"Name :"<<name;
cout<<"\n\nBahasa Melayu 1 :"<<mark_bm1[a];
cout<<"\tGred B";
}
else if(mark_bm1[a]>39||mark_bm1[a]<60)
{
cout<<"Name :"<<name;
cout<<"\n\nBahasa Melayu 1 :"<<mark_bm1[a];
cout<<"\tGred C";
}
else
{
cout<<"Name :"<<name;
cout<<"\n\nBahasa Melayu 1 :"<<mark_bm1[a];
cout<<"\tGred D";
}
if(mark_bm2[a]>=80)
{
cout<<"\n\nBahasa Melayu 2 :"<<mark_bm2[a];
cout<<"\tGred A";
}
else if(mark_bm2[a]>59||mark_bm2[a]<80)
{
cout<<"\n\nBahasa Melayu 2 :"<<mark_bm2[a];
cout<<"\tGred B";
}
else if(mark_bm2[a]>39||mark_bm2[a]<60)
{
cout<<"\n\nBahasa Melayu 2 :"<<mark_bm2[a];
cout<<"\tGred C";
}
else
{
cout<<"\n\nBahasa Melayu 2 :"<<mark_bm2[a];
cout<<"\tGred D";
}
if(mark_math[a]>=80)
{
cout<<"\n\nMathematics :"<<mark_math[a];
cout<<"\tGred A";
}
else if(mark_math[a]>59||mark_math[a]<80)
{
cout<<"\n\nMathematics :"<<mark_math[a];
cout<<"\tGred B";
}
else if(mark_math[a]>39||mark_math[a]<60)
{
cout<<"\n\nMathematics :"<<mark_math[a];
cout<<"\tGred C";
}
else
{
cout<<"\n\nMathematics :"<<mark_math[a];
cout<<"\tGred D";
}
if(mark_science[a]>=80)
{
cout<<"\n\nScience :"<<mark_science[a];
cout<<"\tGred A";
}
else if(mark_science[a]>59||mark_science[a]<80)
{
cout<<"\n\nScience :"<<mark_science[a];
cout<<"\tGred B";
}
else if(mark_science[a]>39||mark_science[a]<60)
{
cout<<"\n\nScience :"<<mark_science[a];
cout<<"\tGred C";
}
else
{
cout<<"\n\nScience :"<<mark_science[a];
cout<<"\tGred D";
}
if(mark_bi[a]>=80)
{
cout<<"\n\nBahasa Inggeris :"<<mark_bi[a];
cout<<"\tGred A";
}
else if(mark_bi[a]>59||mark_bi[a]<80)
{
cout<<"\n\nBahasa Inggeris :"<<mark_bi[a];
cout<<"\tGred B";
}
else if(mark_bi[a]>39||mark_bi[a]<59)
{
cout<<"\n\nBahasa Inggeris :"<<mark_bi[a];
cout<<"\tGred C";
}
else
{
cout<<"\n\nBahasa Inggeris :"<<mark_bi[a];
cout<<"\tGred D";
}
}
cout<<"\n Average for Bahasa Melayu 1:"<<average_bm1;
cout<<"\n Average for Bahasa Melayu 2:"<<average_bm2;
cout<<"\n Average for Mathematics:"<<average_math;
cout<<"\n Average for Science:"<<average_science;
cout<<"\n Average for English is:"<<average_bi;
}
void main()
{
Student obj1;
obj1.accept();
obj1.Accept();
obj1.display();
} -
QUOTE(HeaVen X @ Dec 12 2008, 07:36 PM) <{POST_SNAPBACK}>jawapannye suami isteri
betul x??
betul.............betul................jawapannye suami isteri................pandaila kau ni heaven x -
salah...........cuba lagi -
ok.........try aku punye gak.........
peguam ialah pembunuh punye ayah, pembunuh ialah hakim punye anak,
apa hubungan antara hakim dengan peguam? -
haahahaha.............dengar org indon amuk die...........
alamak ader org indon ke kt cini??????????sorry -
lagu happy..........love so sweet by arashi
Romaji Love So Sweet
Kagayaita no wa kagami demo taiyou de mo nakute kimi dato kizuita toki kara
Ano namida gumu kumo no zutto ue ni wa hohoemu tsuki Love story
mata hitotsu
Kizutsuita yume wa kinou no kanata e
Sora ni hibike ai no uta
Omoide zutto zutto wasurenai sora futari ga hanarete ittemo
Konna suki na hito ni deau kisetsu nido to nai
Hikatte motto saikou no Lady Kitto sotto omoi todoku
Shinjiru koto ga subete Love so sweet
Soko kara itsumo mieru youni
Kono te wo sora ni muke hirogaru kimi to no omoide
Ano kataku na de ijippari na
boku wo kaeta kimi no te Love story aruki dasu
Magari kunetteta futatsu no tabiji wa
Koko de hitotsu niji ni nare
Omoide zutto zutto oikaketa yume futari ga tooku e ittemo
Donna tsurai yoru mo kujike souna chikai de mo
Waratte motto saigo no lady kitto sotto negai todoku
Akenai yoru wa nai yo Love so sweet
Tsutae kirenu itoshisa wa
Hana ni natte machi ni futte
Doko ni ite mo kimi wo “koko" ni kanjiteru
Omoide zutto zutto wasurenai sora futari ga hanarete ittemo
Konna suki na hito ni deau kisetsu nido to nai
Hikatte motto saikou no lady kitto sotto omoi todoku
Shinjiru koto ga subete
Akenai yoru wa nai yo
Shinjiru koto ga subete Love so sweet
english
What shined was neither the mirror nor the sun but you. Since then
Behind those tearful clouds is always a smiling moon. Another love story
Take the wounded dreams to yesterday
The sky will echo with the song of love
The sky will always, always remember the memories, even if we drift apart
For the girl I love so much, even if we won’t meet the second time
Shine more, you’re the best lady. My feelings will definitely, gently reach to you
Believing is everything. Love so sweet
So that you’ll always be able to see from there
I’ll spread my arms towards the sky and memories with you will spread
Your hands that changed
My stubborn and arrogant self. Love story will start
Our two winding paths will
Will be one rainbow here.
My dream of always, always chasing after our memories. Even if our distance grows
No matter how tough the night gets, no matter how hopeless the promise is
Laugh more, you’re the last lady. My prayers will definitely, gently reach to you
The sun will always rise. Love so sweet
The love I couldn’t express completely
Will turn into flowers and fall on the city
No matter where you go I’ll always feel your presence “here��?
The sky will always, always remember the memories, even if we drift apart
For the girl I love so much, even if we won’t meet the second time
Shine more, you’re the best lady. My feelings will definitely, gently reach to you
Believing is everything.
The sun will always rise.
Believing is everything. Love so sweet
-
teri-chan help............help............
-
i'm having an internship or
i'm having a practical
which one do you think better???????? -
me a chance to live
then i go to safety
place and trying to help -
i'm really not sure............just be yourself..........
ask them if don't understand something...........
and try to communicate with all the staff.............
i was practice this thing when i was having my practical..........
----->is it a correct grammar????i'm having a practical..........cause i fell weird......... -
i think i saw a
light then suddenly a miracle
happen i was still allive
----->seriouslly????? don't want it end so fast -
i was freak out so
----->hehehe wanna join to -
QUOTE(fiza_cute @ Dec 11 2008, 09:53 AM) <{POST_SNAPBACK}>i'm going to practical in Seremban..SUK..gov company..i'm scared..i'm not good in IT..
that's ok..........i'm having practical now............my it knowledge not good either.........insyaalllah they will teach you............before i'm having practical i don't even know how to format pc or laptop............now i;m kind of pro.............hehehehe...........i'm going to finished tomorrow..........wish me luck having my last day here.............i hope not gonna cry.............
-
walaupun aku x paham sgt tp aku dgr............ekonomi dunia mmg dh teruk.........psl saham us jatuh...........byk company nk pecat pekerja...........so dependla..........kalau rasa leh dpt keje baru lg bagus berhenti pun xper.................tp nasihat aku dh dpt keje baru, baru bleh blah............correct me if i'm wrong............... -
hahahaha sian laki 2............... -
alamak x tgk lg la citer 2..........sape hero die??????best x citer die????? -
die la...............ryo so kawai
hero taiyo no uta plak Yamada Takayuki
-
laaaaaa....... td die yg ckp erika 2 sakit............tipah tertipu ke.............apapun.........hero die tetap best sape name die????????lupa la........... -
hahaha mmg dh tgk pun taiyo no uta.................
betul ke die sakit???????sakit ape plak???????? -
best citer die..............sedih giler............Erika Sawajari tu asyik b'lakon sakit je...............xde watak lain ke???????? -
Lawak budi bahasa
Seorang gadis cantik menaiki LRT yang sangat penuh sesak. Gadis itu berdiri betul betul didepan seorang pemuda. Seketika kemudian pemuda itu bangun, namun belum sempat pemuda itu
berkata apa apa, gadis cantik itu menolak pemuda itu dengan lembut ke tempat duduknya sambil berkata, "Terima kasih, saya lebih suka berdiri". Pemuda itu tercengang dengan penuh kehairanan.
Dia sedikit jengkil kerana ditolak oleh gadis itu walaupun secara lembut. Pemuda itu pun berdiri semula tetapi sekali lagi gadis cantik itu menolaknya duduk semula dan berkata dengan
sedikit kuat hingga didengari oleh lain lain penumpang, "Tak apa, tak payah susah susah, saya lebih suka berdiri." Tanpa putus asa pemuda itu berdiri lagi untuk kali yang ketiga sambil menjerit,
"Woii cik kak !! Saya nak turun laaaaa!!! Saya dah terlepas perhentian saya tau !!? Apa punya perasan lah dia ni?!!!"
-
aku ada time malam 2.............tenang je hati aku tgk bulan 2...........subhanallah -
rena hidup lg.............tp die dh kembali ke black organizations balik la............
Tolong Check Kan
in C, C++
Posted · Report reply
tak boleh, array mesti ada saiz.
sila tengok malloc, realloc dan free
[url="http://www.cplusplus.com/reference/clibrary/cstdlib/malloc/"]http://www.cplusplus...cstdlib/malloc/[/url]
ubah mark_*... menjadi integer pointer
[code]int* mark_bm1, mark_bm2, mark_math ...[/code]
sebelum
[code] for(a=0;a<bil;a++)[/code]
letak kod ini untuk allocate memory
[code]mark_bm1 = (int)malloc(sizeof(int)*bil);[/code]
[/quote]
ok............dh try tp ade 6 error..........camni ke???????
#include<iostream>
#include <string>
using namespace std;
using std::string;
class Teacher
{
protected:
char stafname[25],stafid[10];
public:
void accept()
{
cout<<"\nEnter your name :"<<endl;
cin>>stafname;
cout<<"\nEnter staffid :"<<endl;
cin>>stafid;
}
};
class Student:public Teacher
{
private:
char Class[3],subject[12],name[25];
int *mark_bm1[100],*mark_bm2[100],*mark_math[100],*mark_science[100],*mark_bi[100];
int a,bil, total,*average[100];0
public:
void Accept();
void display();
};
void Student::Accept()
{
cout<<"****************SELAMAT DATANG KE**************************";
cout<<"\nSISTEM PENGIRAAN PURATA PERMAKAHAN DAN GRED PELAJAR UPSR";
cout<<"\n*********************************************************";
cout<<"\nEnter Class :";
cin>>Class;
cout<<"\nEnter number of student :";
cin>>bil;
mark_bm1 = (int)malloc(sizeof(int)*bil);
mark_bm2 = (int)malloc(sizeof(int)*bil);
mark_math = (int)malloc(sizeof(int)*bil);
mark_science = (int)malloc(sizeof(int)*bil);
mark_bi = (int)malloc(sizeof(int)*bil);
for(a=0;a<bil;a++)
{
cout<<"\nEnter student name :";
cin>>name;
cout<<"\nEnter mark for Bahasa Melayu 1 :";
cin>>*mark_bm1[a];
cout<<"\nEnter mark for Bahasa Melayu 2 :";
cin>>*mark_bm2[a];
cout<<"\nEnter mark for Mathematics :";
cin>>*mark_math[a];
cout<<"\nEnter mark for Science:";
cin>>*mark_science[a];
cout<<"\nEnter mark for English:";
cin>>*mark_bi[a];
total=*mark_bm1[a]+*mark_bm2[a]+*mark_math[a]+*mark_science[a]+*mark_bi[a];
*average[a]=total/5;
}
}
void Student::display()
{
cout<<"\n==========================================";
cout<<"\nClass :"<<Class;
cout<<"\t\tBil. Student :"<<bil;
for(a=0;a<bil;a++)
{
if(*mark_bm1[a]>=80)
{
cout<<"\nName :"<<name;
cout<<"\n\nBahasa Melayu 1 :"<<*mark_bm1[a];
cout<<"\tGred A";
}
else if(*mark_bm1[a]>59&&*mark_bm1[a]<80)
{
cout<<"\nName :"<<name;
cout<<"\n\nBahasa Melayu 1 :"<<*mark_bm1[a];
cout<<"\tGred B";
}
else if(*mark_bm1[a]>39&&*mark_bm1[a]<60)
{
cout<<"\nName :"<<name;
cout<<"\n\nBahasa Melayu 1 :"<<*mark_bm1[a];
cout<<"\tGred C";
}
else
{
cout<<"\nName :"<<name;
cout<<"\n\nBahasa Melayu 1 :"<<*mark_bm1[a];
cout<<"\tGred D";
}
if(*mark_bm2[a]>=80)
{
cout<<"\n\nBahasa Melayu 2 :"<<*mark_bm2[a];
cout<<"\tGred A";
}
else if(*mark_bm2[a]>59&&*mark_bm2[a]<80)
{
cout<<"\n\nBahasa Melayu 2 :"<<*mark_bm2[a];
cout<<"\tGred B";
}
else if(*mark_bm2[a]>39&&*mark_bm2[a]<60)
{
cout<<"\n\nBahasa Melayu 2 :"<<*mark_bm2[a];
cout<<"\tGred C";
}
else
{
cout<<"\n\nBahasa Melayu 2 :"<<*mark_bm2[a];
cout<<"\tGred D";
}
if(*mark_math[a]>=80)
{
cout<<"\n\nMathematics :"<<*mark_math[a];
cout<<"\t\tGred A";
}
else if(*mark_math[a]>59&&*mark_math[a]<80)
{
cout<<"\n\nMathematics :"<<*mark_math[a];
cout<<"\t\tGred B";
}
else if(*mark_math[a]>39&&*mark_math[a]<60)
{
cout<<"\n\nMathematics :"<<*mark_math[a];
cout<<"\t\tGred C";
}
else
{
cout<<"\n\nMathematics :"<<*mark_math[a];
cout<<"\t\tGred D";
}
if(*mark_science[a]>=80)
{
cout<<"\n\nScience :"<<*mark_science[a];
cout<<"\t\tGred A";
}
else if(*mark_science[a]>59&&*mark_science[a]<80)
{
cout<<"\n\nScience :"<<*mark_science[a];
cout<<"\t\tGred B";
}
else if(*mark_science[a]>39&&*mark_science[a]<60)
{
cout<<"\n\nScience :"<<*mark_science[a];
cout<<"\t\tGred C";
}
else
{
cout<<"\n\nScience :"<<*mark_science[a];
cout<<"\t\tGred D";
}
if(*mark_bi[a]>79)
{
cout<<"\n\nBahasa Inggeris :"<<*mark_bi[a];
cout<<"\tGred A";
}
else if(*mark_bi[a]>59&&*mark_bi[a]<80)
{
cout<<"\n\nBahasa Inggeris :"<<*mark_bi[a];
cout<<"\tGred B";
}
else if(*mark_bi[a]>39&&*mark_bi[a]<59)
{
cout<<"\n\nBahasa Inggeris :"<<*mark_bi[a];
cout<<"\tGred C";
}
else
{
cout<<"\n\nBahasa Inggeris :"<<*mark_bi[a];
cout<<"\tGred D";
}
cout<<"\n\nAverage :"<<*average[a];
}
cout<<"\n==========================================";
}
void main()
{
Student obj1;
obj1.accept();
obj1.Accept();
obj1.display();
}