Pages

hye all



Tuesday 28 February 2012

dugaanku

hari ni adalah hari-hari terakhir class untuk sem nih bagi aku n kawan2 yang lain..
bagi aku nilah saat dan detk yang sangat-sangat mencabar..
aku x penah rasa susah mcm nih
hari ni..bersamaan dengan 28.2.2012 dua benda pentang yang akan kami lalaui...
1.test csc 159(x baca apa2)
2.presentation csc 138(dah sebulan dok kat ngn benda nih)
nilah saat yang paling susah yang penah aku rasa sejak2 aku
 menjejakkan kaki disini...
ari nih jugk..kawan2 aku berkampung di bilik aku semata-mata nak wat bendaalah nih nihh..
codingdi panjang...aku rasa kalau aku buat sorang mesti x boleh wat..


nih sample coding



#include <iostream>
#include <conio.h>
#include <fstream>


struct choice{
char name[60],paymentname[20],cotname[20],hp[20],ic[30];
int package,payment,adult,child,price1,price2;
float disc,cot,total ;
};


void show();
void details(choice &c);
void calculate(choice &c);
void categories(choice &c);
void outputcom(choice &c);


main(){


choice *a=new choice;
ofstream output;
char x='Y';
while (x=='Y'){
show();
details(*a);
   categories (*a);
   calculate(*a);
   outputcom(*a);
   output.open("resit.txt",ios::app);
    output<<"\n*****************************************************************************\n";
    output<<"\t\t        WELCOME TO IRANAISTON THEME PARK"<<endl;
    output<<"\nFULL NAME\t\t: "<<a[0].name;
    output<<"\nPHONE NUMBER\t\t: "<<a[0].hp;
  output<<"\nNO. OF IC\t\t: "<<a[0].ic;
      output<<"\nCATEGORIES\t\t: "<<a[0].cotname;
      output<<"\nNO. OF ADULT AND CHILD\t: "<<a[0].adult<<" , "<<a[0].child;
      output<<"\nPACKAGE\t\t\t: "<<a[0].package;
      output<<"\nPAYMENT WITH\t\t: "<<a[0].paymentname;
      output<<"\nTOTAL PAYMENT\t\t: RM"<<a[0].total;
      output<<"\n*****************************************************************************";
    output.close();
      cout<<"\n\nDo you want to continue? (Y/N)"<<endl;
      cin>>x;
      cin.get();
      }
getch();


}


void show(){
cout<<"\t\t************************************************"<<endl;
cout<<"\t\t        WELCOME TO IRANAISTON THEME PARK"        <<endl;
   cout<<"\t\t              PACKAGE 1 = OUTDOOR "              <<endl;
   cout<<"\t\t              PACKAGE 2 = INDOOR "               <<endl;
   cout<<"\t\t              PACKAGE 3 = SNOWWORLD "            <<endl;
   cout<<"\t\t              PACKAGE 4 = ALL "                  <<endl;
   cout<<"\t\t************************************************"<<endl;
   }


void details(choice &c){
cout<<"\n\n\nPLEASE ENTER YOUR DETAILS"<<endl;
   cout<<"\nNAME: ";
cin.get(c.name,60);
cout<<"PHONE NUMBER: ";
   cin.get();
cin.get(c.hp,20);
cout<<"IC NUMBER: ";
   cin.get();
cin.get(c.ic,30);
   }




void categories(choice &c){
cout<<"NUMBER OF GROUP MEMBER : ";
cin>>c.cot;
    if(c.cot<=8){
    c.cot=1;
      strcpy (c.cotname,"Single");}
    else if(c.cot<=20){
    c.cot=0.90;
      strcpy (c.cotname,"Family");}
      else{
    c.cot=0.80;
      strcpy (c.cotname,"Group");}
}




void calculate(choice &c){
   cout<<"ENTER YOUR PACKAGE: ";
   cin>>c.package;
      {
    if(c.package==1){
    c.price1=20;}
    else if(c.package==2){
c.price1=24;}
      else if(c.package==3){
      c.price1=10;}
      else
      c.price1=65;
      }
      cout<<"ENTER NUMBER OF ADULT (0 if nobody): ";
cin>>c.adult;
cout<<"ENTER NUMBER OF CHILD (0 if nobody): ";
cin>>c.child;


      c.price2=(c.adult*c.price1)+(c.child*c.price1*0.90);




cout<<"ENTER YOUR PAYMENT CHOICE (1-Cash/2-Credit Card): ";
   cin>>c.payment;


    if(c.payment==1){
    c.disc=1;
      strcpy (c.paymentname,"Cash");}
      else{
      strcpy (c.paymentname,"Credit Card");
      c.disc=0.90;}




   c.total=c.price2*c.disc*c.cot;
}


void outputcom(choice &c){
cout<<"\nFULL NAME\t\t: "<<c.name;
   cout<<"\nPHONE NUMBER\t\t: "<<c.hp;
cout<<"\nNO. OF IC\t\t: "<<c.ic;
   cout<<"\nCATEGORIES\t\t: "<<c.cotname;
   cout<<"\nNO. OF ADULT AND CHILD\t: "<<c.adult<<" , "<<c.child;
   cout<<"\nPACKAGE\t\t\t: "<<c.package;
   cout<<"\nPAYMENT WITH\t\t: "<<c.paymentname;
   cout<<"\nTOTAL PAYMENT\t\t: RM"<<c.total;
   }




~~~~nh plak output dy~~~~





nilah yang mampu aku dan kawan2 aku buat..
nihlah yng habis baik kami dah buat,,
hasil editkan kami dan kawan yang lain

****orang yang x tahu apa2 akan kata "eleh...simple saja.....senang ja" tapi..kami yang buat nih merasai     kesusahan nak buat benda nih.....

****2.00q.m bersama (nadia,aku,shahirah,anis,ida,amirah)

**** esok nak presnt.doakan kami.....





No comments:

Post a Comment