Sunday, March 19, 2006

GACC 06 v3

*Just pasang back my computer after a quite long sleep*

*edit: add stuff in it, with "missing friday and saturday*

Hmm.... more then one months since the last post. is very very very very very bz with academic stuff and also GACC. now i shall detail type out what had i done for this whole months

since last post until tuesday (15th March)
In very bad condition,
Academic problems:-
Need to settle with the group member for each assignment is not easy as we have 9 people to devide, and we can't put all good grades people in the same groups also. Solving this is more harder then solving differenciate question. Tons of works to do. Sorry to my TCL group members coz didn't do my part of work well m(_ _)m

Event problems:-
A lot of problems, even had a very very very bad thought of it. But i still get through all of it.

Family:-
har??? no, i have no family problems. Just that 2 weeks ago i suppose to went back home but due to some unforeseen problem i had to canceled the trip back on that morning. My mom i know she is disappoint for it since she had already prepare a lot of food for me. My sis is a bit angry with me for FFK her for the bowling trip. My bro is the ones that most angry since he had to go back himself and he the one that go to buy the tickets.

And On GACC itself

I guess i start from Wednesday (15th March)
Afternoon was at the booth discuss abt the decoration of the venue. After that i suggest that we make a elior (the mascot name, named by the creator but ot much people knows this) model to hang on the stage. And some of the comms agrees with it, then we went to get some materials and start the work at night.

Thursday (16th March)
Still doing elior in early in the morning, rest at around 3 something went to McD to grab something to eat. Then finish 1st part around 6 something. Tot to study for friday's test but am really tired. So decide to have a sleep and wake up at 7 coz that day got 8am class. But when i get up is nearly 10, when li sa called me to take the tv from CITS. After setting up the booth at CLC concourse then went to John's house to get my katana spray with silver. Then went to class at 12, tot that there are some tips for friday's test. But then the lecture said read all the stuff that i said before. >_<>_<. Got working committee that night, overroll the meeting is quite ok with a few confusion among divisions. After that we move to exam hall to clean up the hall as MBMB is going to arrived 2molo 8am (yeah, they always picked the damn ultra good time to come >_>). After clearing the hall, edo and the rest suppose to come my house and finish elior. But then elior is still wet, so i have to pasang a fan and blow it for the whole night and ask they all come 2molo. After that shifting my comp to downstairs as going to shift my comp in the exam hall and Alan is coming to do the TCL assignment also. Finish my part of assignment at around 3am and went to sleep immediately.

Friday (17th March)
Get up around 7 something. Doesn't feel very well as i can't really have my breakfast at all (have the feeling to muntah), and feeling unstable when walking to campus. Went to exam hall 1st and saw workers from MBMB already start assembling the stage. Saw Justin were there to moniter they assemble the stage. when they put up the 1st plank on the stage, i was like O__O since the stage is damn high >_<>_>). anyways since people are able to stand on top the stage without hitting the celling then we were ok with it. After that went to CCC to get the note to editor that going to send to the press on that morning (we suppose to send it in thursday but then techinical problem we have to send it on friday >_<). After got the note to editor, went to FMD to check out the lorry that went to Pay Fong to get the partition. The working comms were quite excited since is like the war times that they all have to sit behind the lorry. After that went back to exam hall to check out the stage and ask the status of all matters with the comms that in exam hall that time. Went back home after that to print out the note to editor and went to STAD to fax it to the press.

*and continues.....*

Naz: Miracle? I guess we all got it by making a chit-chat of me and kid to a sucess event that previously no one ever had done it in MLK. :D Just make don't give up until the last minute and sure miracle will happen.

Wednesday, February 15, 2006

To a frenz

*Having many things to buy and also still feeling shitty*

To my frenz who currently having personal problems


Promise





*in Romanji*
Lyrics: Natsumi Kobayashi Music: Masataka Kitaura

Kagayaku kimi no hitomi ni chikatta
Chiisana mado kara aozora ga mieta gogo
Nigeru koto nante mou shitaku wa nai yo
Senaka ni atatakai te no hira wo kanjiteru

Kizutsuku yori mo tsurai no wa
Ashita wo akiramete
Jibun ni usotsuki tsudukeru koto

Daiji na yume wo hitotsu
Kokoro ni itsudemo
Shinjite mamotte norikoete yukou
Daiji na yume ga aru kara
Motto tsuyoku nareru
Omoi egaita mirai wo dakishimete
Korekara mo

Sukoshi dake mae wo aruku kata goshi
Onnaji ho haba de shiroi kumo oikaketeta
Eran da michi ga tadashiika nante
Dare ni mo wakara nai mayou toki mo aru keredo

Tsumaduku koto wo kowagatte
Matte iru dake ja
Kinou to nani mo kawara nai kara

Daiji na yume wo hitotsu
Futari de itsudemo
Shinjite mamotte aruki tsuduke you
Daiji na yume ga aru kara
Mae dake wo mitsumete
Motto haruka na mirai wo mezashiteku
Korekara mo

Kizutsukete kizutsukerarete
Kuyashikute naita hi mo
Tsugi no DOA hiraku yuuki wo
Kimi ga kureta yo

*Repeat

*in English
Translation: Jonathan Wu

One afternoon, as the blue sky was visible through the window
I made a promise, looking at your sparkling eyes
that I’ll no longer run away from anything.
You put your hand on my back, and I feel the warmth

Rather than giving up on tomorrow
because of pain and sorry,
I just keep on kidding myself

But there will always be one important
dream inside my heart, that I protect
and believe in, allowing me to surmount anything
And because that important dream is there
I can keep becoming stronger
so from now on untill forever, I will
embrace the future I imagined

Before we take a step, shoulder by shoulder
we chased the wild clouds
Whether or not the road we choose is the right one
nobody can tell us, but we’ll know when we stray from it

If you’re afraid of stumbling
don’t just sit and wait because then
nothing will be no different from yesterday

But there we will always be one important dream
that we can protect and believe in,
we can keep on walking
And because that important dream is there
we can look back and then start to aim
towards the far away future
so from now untill forever

On the days when I’m hurt
and cry because of the pain
I can open up the door
to the future, because you gave me courage

*Repeat

Monday, February 13, 2006

Feels Shitty

Curently feels very very shitty. *The End*

Saturday, January 28, 2006

恭贺新喜

Happy Chinese Nee Year (English)
Selamat Tahun Baru Cina (Malay)
Xin Nien Kui Le (Chinese)
Xin Jia Ju Yi (Teochew)

wanna wish everyone happy new year, since in the same week chinese and the muslim celebrate their new year ^_^

and now
*from last post*

nothing much in following day. just that met shirley who i haven meet her almost half a year, still the same (including her height). and we went to CC to play some games since she ask me that day to teach her play dota. after 2 games she is still bler about why dota is so interesting but i can't really explain very detail to her about this >_<. after that we have a game of d-day, almost forgot how to play since is very long time i didn't play this game. but have a quite fun day on that day since long time didn't went to CC and play. after that a few days later we all went to the new Jusco Tebrau. the place is quite big, have a lot of new shops that never appear in JB before (mostly those branded shop). we arrived there around 7 something and waited for khian wee and also wei lin to come. (they are quite late becoz need to wait khian wee to finish his work). we walke around the complex to have a look since keng hui and shirley never been before (for me i went there the day before, so still consider new for me). there got one tgv cineplex, jusco, harris (popular book store, but is almost like kinokuniya got cafe and etc), and others. we waited there around an hour plus coz khian wee met traffic jam on the way. after that we went to a chinese restaurent to have our dinner. the funny thing there is that they have a tea call "one meter tea". we all were wondering what tea is that, after that we ask the waiter then he said that the one meter tea is actually teh tarik >_< after dinner is quite late (around 10.30pm), so we decide to went back since afraid that no taxi for us to went back home (taxi here tend like to wait until 12am coz can charge 50% extra >_<).

at home actually nothing much special, since is doing the same thing every year (cleaning, packing, arranging things and etc).

oh about my result, yeah i pass all and improve. but i still unsure about my gpa since my expression when i count that my gpa is something thing like this ==> O__O, i think i need to wait until the detial result release. until then c ya all ^^

Thursday, January 19, 2006

JB : Day 1 & 2

*Going to whack up the comp that i using now since is supppppper laggin*

1st 48 hours coming back to JB is really a lot for me (or too much >_<). Maybe due to my "crazyness" celebration *refer to previous post* currently feel quite dizzy. Tot that it gone after a short sleep in bus, but the truth is it get worst. walking sometimes also get feel unbalance >_<. Then come back and lepaking in house around for the whole afternoon. My father show us his new "XXL" size Petronas Twin Tower which is going to display in his fren's son wedding in this saturday and i would think that base is too plain. Night doin nothing coz the comp has no modem driver (missing in action).

next day morning went to JPJ to change my lesen pemandu. Finally i out of "P" :D. but i can't be too happy about it coz i drop my SD card infront of a shop near my house and i only found out 5 hours later >_<. after that we went to find and thank godness that is found, or else i will be bored to death for loss it (all my mp3s are in it >_<).The night was bz with reply e-mails and also solving some problems for GACC with some hi-comms.

*continue in next post*

Tuesday, January 17, 2006

Welcome To Geofront

*Should be clean up thing and prepare to go back*

Recently i am very confuse on many thing, a lot of people tell me how to do but a lot of them have clashes with each other. This is my first time to be a leader for such a big "Tanggungjawab". I understand that most of u were very unhappy with me. Just think about all the things that i done found out that i just not "myself". Why i should not care about the detials, why should i not care of everything? I blame myself after i figure out all of this. There is another less then 2 months and some of them were like running datona to rush out everything and some of them were like riding the antique car in Genting. if u are one of them n currently reading this entry, there is one quote that i hope you can understand

Quote Leo McGarry (The West Wing):
"If we're going to walk into walls I want us running into them full speed. We're going to lose some of these battles, and we might even lose the White House, but we're not going to be threatened by issues. We're going to bring 'em front and center. We're going to raise the level of public debate in this country, and let that be our legacy."


When i watching this episode i seriouly think that i am in the same situation. And now i shall not be confused anymore.

Monday, January 16, 2006

Crazy After Exam Celebration

Been "missing" since the start of the exams. Me and my classmates had our most craziest after exam celebration since we entered MMU. In 2 weeks, there are 3 days i slept at around 8 in the morning. My parents will kill me if they saw this >_<

2nd January 2006
Rushing my CP2 assignment 3 in my friends house after Yum Cha with Khurshid and Nikki. Arrived John's house around 1 something coz Daryl is there asking help from John. After that we went to Daryl house to finish up our assignment coz John need to finish his assignment too. Then been thinking and typing in Daryl's house in "Stealth mode" coz his family were sleeping. Then finish all around 6 something in the morning then called Sing Li, John, Alan to dim sum. When back and sleep around 8.30 am.

12th January 2006
Finished my exams around 3.11pm (My exam starts at 2.30pm). After that wait until night went to Sungai Duyung (hope i didn't get the name wrong) eat seafood with Sing Li, Daryl, Chee Keong, John, Alan, Lee Way and Kan Way. Then went to MP to play bowling but was closed, so we went to Senyum and play until 1am. At the way going to the car park saw Jason and others playing snooker. Then went back to Bukit Beruang have supper in Cahaya Dinar. After supper went to the CC in front US pizza and play until 6am. Played 2 games, 1st game lost coz can't stop SA (Kan Way playing it) from killing us. Controlled the second game with Sing Li coz using me using Slayer and was left alone in the early part of the game and Sing Li get to track SA(Kan Way again, damn lucky for him that night) by using Gondar and kill him few times. Then went for Dim Sum again and come back home around 8 something.

13th January 2006
Today Sing Li and Chee Keong went to KL and meet with CK (not Chee Keong, is Chun Kit - my alpha groupmate) and Yeow Ming (or we usually call him YM). Then around 4pm John call me and ask me to have some desert in Taman Kerjasama. Then at night we all went to Jonker have a walk. I brought a pouch and currently still thinking what to put inside >_<. After that went to Taman Kerjasama the mamak shop near the bus stop there have some supper then come back home around 1am.

14th January 2006
Sing Soon and Ben (John's Housemate) finish their exams today. So we went to Pure Bar to celebrate. I not sure izzit i am really tired or what, but the atmosphere there making sleepy even the speaker there is in its max. After that me and John sit outside and have some fresh air (inside really terrible since some of them were smoking inside and there is a hell lot of people in there). After that went to Kota Laksamana have some supper. Then come back to BB around 3am then went to CC again. Played quite badly, lost both games. Was start winning in the third games but the timed up in the middle of the game >_<. Went to dim sum again, then sleep at around 7.30 am.

15th January 2006
Woke up around 3pm, then my landlord came around 3.30pm (thank god i woke up that time >_<) then watch some episode of The West Wing that just finished download. As i finish reading my mails and thinking the reply, John called and ask me to go bowling in MP. I was like O__O since they going back on the next day in the morning and they said need to get sleep early that day. Then went to MP and play. That night everyone played very well by each of us getting very high mark. Alan got 2 double and some other spare and get 179 points O__O. Me myself i also got my highest mark by getting 98 points ^_^v. Then went to USB have some supper and come back around 1 something.

16th January 2006
Typing this post after i woke up, going to get my hair cut and meet with Justin around 2 to get my HDD. Then after that need to come back and copy things in my HDD and went to khurshid house for him to leech. Then after that went back home and start packing up for going back.

17th Januari 2006
back to JB. Will come back mostly on the 8th day of Chinese New Year (Sunday)

Saturday, January 07, 2006

Some Video on Malaysia Car

Come across some videos on some reviews on Malaysia Car by a television program in BBC. Just view it then u will know.






Wednesday, December 28, 2005

Assignment 2

My code for my computer programming assignment 2. You been warned that reading it might cause ur brain in deeply stressed. Please use the compiler that have been post in the last post to get a clearer view on the program.


#include <iostream>

#include <string>

#include <fstream>

using namespace std;



class Account

{

    public:

        int acc_type;

        string acc_name1;

        string acc_ic1;

        string acc_contactNo1;

        string acc_address1;

        string acc_name2;

        string acc_ic2;

        string acc_contactNo2;

        string acc_address2;

        float acc_balance;

        int index_no;

        int acc_no;

        Account(): acc_name2("0"),
acc_ic2("0"), acc_contactNo2("0"),

                  
acc_address2("0"), acc_balance(0.0){}

        int input_data(int index, int accNo);

        void display_data();

        void display_type();

        int s_to_n_convert(string x);

        float s_to_f_convert(string x);

        string display_accType(int x);

        int read_file();

        void errormsg();

};



int Account::read_file()

{

    ifstream read;

    char answer;

    read.open ("Account.txt");

    if (read.fail()==1)

    {

        cout << "\aFile not found!\n";

        do{

            cout << "Want
to create new file? (Y/N): ";

            cin >>
answer;

            if(answer ==
89 || answer == 121)

            acc_no =
1000001;

            else if
(answer == 'n' || answer == 'N')

            return 0;

            else

            cerr << "\aInvalid
respond entered, please try again!\n";

            system("pause");

        }while(answer!=89&&answer!=121&&answer!='n'&&answer!=
'N');

    }

}



void Account::display_type()

{

    cout << "Account Type: " << endl;

    cout << "1. Personal Saving Account" << endl;

    cout << "2. Join Saving Account (AND signing)" << endl;

    cout << "3. Join Saving Account (OR signing)" << endl;

}



string Account::display_accType(int x)

{

    switch (x)

    {

        case 1: return "1. Personal Saving
Account"; break;

        case 2: return "2. Join Saving
Account (AND signing)"; break;

        case 3: return "3. Join Saving
Account (OR signing)"; break;

    }

}



int Account::s_to_n_convert(string x)

{

    char temp1[255];

    strcpy (temp1, x.c_str());

    int temp = atoi(temp1);

    return temp;

}



float Account::s_to_f_convert(string x)

{

    char temp1[255];

    strcpy (temp1, x.c_str());

    float temp = atof(temp1);

    return temp;

}

int Account::input_data(int index, int accNo)

{

    string respond;

    do{

        system("cls");

        //cout << index << endl;

        Account::display_type();

        cout << "Please choose the type of
account (0 to exit): ";

        getline(cin,respond);

        if(respond == "0")

        return 0;

        acc_type = s_to_n_convert(respond);

        if(acc_type<=0 || acc_type >= 4)

        {

            cerr << "\aYou
have enter a invalid choice, please try again\n" ;

            system("pause");

        }

    }while(acc_type<=0 || acc_type >= 4);



    if(index == 0)

    acc_no = 1000000;

    else

    acc_no = accNo + 1;

   

    system("cls");

    cout << "======================" << endl;

    cout << "First Customer Detials" << endl;

    cout << "======================" << endl;

    cout << "Please enter the customer name (0 to exit): ";

    getline (cin, acc_name1);

    if(acc_name1 == "0")

    {

        Account::errormsg();

        return 0;

    }



    cout << "Please enter the customer IC no (0 to exit): ";

    getline(cin, acc_ic1);

    if(acc_ic1 == "0")

    {

        Account::errormsg();

        return 0;

    }



    cout << "Please enter the customer contact No (0 to exit): ";

    getline(cin, acc_contactNo1);

    if(acc_contactNo1 == "0")

    {

        Account::errormsg();

        return 0;

    }





    cout << "Please enter the customer address (0 to exit): ";

    getline(cin, acc_address1);

    if(acc_address1 == "0")

    {

        Account::errormsg();

        return 0;

    }



    if(acc_type == 2 || acc_type == 3)

    {

        system("cls");

        cout << "=======================" <<
endl;

        cout << "Second Customer Detials" <<
endl;

        cout << "=======================" <<
endl;

        cout << "Please enter the customer
name (0 to exit): ";

        getline (cin, acc_name2);

        if (acc_name2 == "0")

        {

           
Account::errormsg();

            return 0;

        }

        cout << "Please enter the customer IC
no (0 to exit): ";

        getline(cin, acc_ic2);

        if(acc_ic2 == "0")

        {

           
Account::errormsg();

            return 0;

        }



        cout << "Please enter the customer
contact No (0 to exit): ";

        getline(cin, acc_contactNo2);

        if(acc_contactNo2 == "0")

        {

           
Account::errormsg();

            return 0;

        }



        cout << "Please enter the customer
address (0 to exit): ";

        getline(cin, acc_address2);

        if(acc_address2 == "0")

        {

           
Account::errormsg();

            return 0;

        }

    }



    system("cls");

    do{

        system("cls");

        cout << "Please enter the amount to
deposit(Type 'exit' to return) :RM";

        string temp;

        getline(cin, temp);

        if(temp == "exit")

        return 0;

        acc_balance = s_to_f_convert(temp);

        if(acc_balance <= 0)

        {

            cerr << "\aYou
have enter an invalid deposit,"

                   
" please reenter again!" << endl;

            system("Pause");

        }

    }while(acc_balance <= 0);



    Account::display_data();

   

    char respond1;

    do{

        cout << "Is the detials above are
correct? (Y/N)" << endl;

        cin >> respond1;

        if(respond1 == 89 || respond1 == 121)

        {

            ofstream
read;

           
read.open("account.txt", ios::out|ios::app);

            read <<
acc_no << ";" << acc_type << ";" << acc_name1 << ";"

                
<< acc_ic1 << ";" << acc_contactNo1 << ";" << acc_address1

                
<< ";" << acc_name2 << ";" << acc_ic2 << ";" << acc_contactNo2

                
<< ";" << acc_address2 << ";" << acc_balance << ";" <<endl;

            read.close();

            cout <<
"Registration Sucessful!\n";

        }

        else if(respond1==78&&respond1==110)

        cerr << "\aRegistration Unsucessful!\n";

        else
if(respond1!=89&&respond1!=121&&respond1!=78&&respond1!=110)

        cerr <<"\aYou have enter an invalid
choice, please reenter again\n";

    }while
(respond1!=89&&respond1!=121&&respond1!=78&&respond1!=110);

    system("Pause");

    cin.ignore();

    return 0;

}



void Account::display_data()

{

    system("cls");

    cout << "Account Detials" << endl << endl;

    cout << "Account No: " << acc_no << endl;

    cout << "Account Type: " << display_accType(acc_type) << endl;

    cout << "Account Balance: RM" << acc_balance << endl << endl;

    cout << "Detials of 1st customer" << endl;

    cout << "=======================" << endl;

    cout << "Name : " << acc_name1 << endl;

    cout << "IC : " << acc_ic1 << endl;

    cout << "Contact No: " << acc_contactNo1<< endl;

    cout << "Address : " << acc_address1<< endl;

    if(acc_type == 2 || acc_type == 3)

    {

        cout << endl;

        cout << "Detials of 2nd customer" <<
endl;

        cout << "=======================" <<
endl;

        cout << "Name : " << acc_name2 <<
endl;

        cout << "IC : " << acc_ic2 << endl;

        cout << "Contact No: " <<
acc_contactNo2<< endl;

        cout << "Address : " <<
acc_address2<< endl;

    }



}



void Account::errormsg()

{

    cerr << "\aRegistration Cancelled\n";

    system("Pause");

}



class date

{

    protected:

        int year, month, day, hour, minute,
sec, dayweek;

        string dayofweek;



    public:



        void selectday(int day);

        void setdate();

        void displaydate();

};



void date::selectday(int day)

{

    int x = day;

    switch (day)

    {

        case 1: dayofweek = "Monday"; break;

        case 2: dayofweek = "Tuesday"; break;

        case 3: dayofweek = "Wednesday";
break;

        case 4: dayofweek = "Thursday";
break;

        case 5: dayofweek = "Friday"; break;

        case 6: dayofweek = "Saturday";
break;

        case 0: dayofweek = "Sunday"; break;

    }

}



void date::setdate()

{

    SYSTEMTIME st;//

    GetSystemTime(&st);



    year = st.wYear;

    month = st.wMonth;

    day = st.wDay;

    hour = st.wHour+8;

    dayweek = st.wDayOfWeek;

    if(hour >23)

    {

        hour = hour-24;

        day++;

        dayweek++;

        if(day > 31)

        {

            day = 1;

            month++;

            if(month >12)

            {

               
month = 0;

               
year++;

            }

        }

    }

    if (dayweek > 6)

    dayweek = 0;

    minute = st.wMinute;

    sec = st.wSecond;

    selectday(st.wDayOfWeek);

   

}



void date::displaydate()

{

    date::setdate();

    //cout << "Year: " << year << endl;

    //cout << "Month: " << month << endl;

    //cout << "Day: " << day << endl;

    //cout << "Hour: " << hour << endl;

    //cout << "Minutes: " << minute << endl;

    //cout << "Seconds: " << sec << endl;

    //cout << "Day: " << dayofweek <<endl;

    cout << dayofweek << ", ";

    if(day < 10)

    cout << "0" << day << "-";

    else

    cout << day << "-" ;

   

    if(month < 10)

    cout << "0" << month << "-";

    else

    cout << month << "-" ;



    cout << year << ", ";

   

    if(hour < 10)

    cout << "0" << hour << ":";

    else

    cout << hour << ":" ;

   

    if(minute < 10)

    cout << "0" << minute << ":";

    else   

    cout << minute << ":" ;



    if(sec < 10)

    cout << "0" << sec ;

    else

    cout << sec ;



    cout << "(GMT+8)" << endl;

}



class AccountRead : public Account

{

    protected:



    public:

        Account database[50];

        int read_file(int mode);

        int display_data(int mode);

        int search(int x);

        void menu1();

        int deposit();

        float withdraw(int i);



};



int AccountRead:: read_file(int mode)

//to read from customer.txt to array

//mode 1 is for create the textfile if it fails to find the textfile

//mode 2 doesn't create the textfile even if it fails to find the textfile

{



    ifstream read;

    char answer;

    read.open ("Account.txt", ios::in);

    if (read.fail()==1)//if it fails to open the text file

    {

        if(mode == 1)//mode 1

        {

            system("cls");

            cout << "\aFile
not found!\n";

            do{

               
cout << "Want to create new file? (Y/N): ";

               
cin >> answer;

               
cin.ignore();

               
if(answer == 'y' || answer == 'Y')

               
{

                   
ofstream write ("Account.txt", ios::out);//create Account.txt

                   
write.close();

               
}

               
else if (answer == 'n' || answer == 'N')

               
return 0;

               
else

               
{

                   
cerr << "\aInvalid respond entered, please try again!\n";

                   
system("pause");

               
}

            }while(answer!=89&&answer!=121&&answer!='n'&&answer!=
'N');

        }

        else if(mode == 2)//mode 2

        {

            return
0;//return null value as it can't found the textfile

        }


    }

    read.close();

    char temp2[255];

    ifstream file_op("Account.txt", ios::in);

    int i=0;

    while (!file_op.eof())//to read the textfile into array

    {

        file_op.getline(temp2, 255, ';');

        database[i].acc_no = atoi(temp2);

   

        file_op.getline(temp2, 255, ';');

        database[i].acc_type = atoi(temp2);

   

        file_op.getline(temp2, 255, ';');

        database[i].acc_name1 = temp2;



        file_op.getline(temp2, 255, ';');

        database[i].acc_ic1 = temp2;



        file_op.getline(temp2, 255, ';');

        database[i].acc_contactNo1 = temp2;



        file_op.getline(temp2, 255, ';');

        database[i].acc_address1 = temp2;



        file_op.getline(temp2, 255, ';');

        database[i].acc_name2 = temp2;



        file_op.getline(temp2, 255, ';');

        database[i].acc_ic2 = temp2;



        file_op.getline(temp2, 255, ';');

        database[i].acc_contactNo2 = temp2;



        file_op.getline(temp2, 255, ';');

        database[i].acc_address2 = temp2;



        file_op.getline(temp2, 255, ';');

        database[i].acc_balance =
atof(temp2);



   

        i++;//to initiate the counter

    }

    file_op.close();

    return i-1;

}





int AccountRead :: display_data(int mode)

{

    system("cls");

    int x = AccountRead::read_file(mode);//to read the file

    if(x == 0)//if there is no records in the textfile

    {

        cerr << "\aNo Records Found!\n";

        system("pause");

        return 0;

    }

    int i;

    do{

        system("cls");

        i = AccountRead::search(x);//to
search the record

        if(i == 1000)

        return 0;

    }while(i >= 1000);



    //to display the result

    system("cls");

    cout <<
"==============================================================\n";

   

    cout << "Account No : " << database[i].acc_no << endl;

    cout << "Account Type : "

         <<
Account::display_accType(database[i].acc_type) << endl;

    cout << "Customer 1 Name : " << database[i].acc_name1 << endl;

    cout << "Customer 1 IC : " << database[i].acc_ic1 << endl;

    cout << "Customer 1 Contact: " << database[i].acc_contactNo1
<< endl;

    cout << "Customer 1 Address: " << database[i].acc_address1 <<
endl;

    if(database[i].acc_type!=1)

    {

        cout << "Customer 2 Name : " <<
database[i].acc_name2 << endl;

        cout << "Customer 2 IC : " <<
database[i].acc_ic2 << endl;

        cout << "Customer 2 Contact: " <<
database[i].acc_contactNo2 << endl;

        cout << "Customer 2 Address: " <<
database[i].acc_address2 << endl;

    }

    cout << "Account Balance : RM" << database[i].acc_balance <<
endl;

    cout <<
"===========================================================\n";

    system("Pause");

}



int AccountRead::search(int x)

{

    cout << "Please enter the account no (0 to exit): ";

    string temp;

    getline(cin, temp);

    if(temp == "0")//to exit

    return 1000;

    int search = Account::s_to_n_convert(temp);//convert string
to int

    if(search == 0)//for invalid input

    {

        cout << "\aNo record found!\n";

        system("pause");

        return 6000;

    }

    for(int i = 0; i <= x; i++)//search record

    {

        if(AccountRead::database[i].acc_no ==
search)//for success search

        return i;//return the index no

    }

    cout << "\aNo record found!\n";//for fail search

    system("pause");

    return 6000;

}



float AccountRead::withdraw(int i)

{

    //to initiate the max amount to withdraw

    float maxWithdraw = database[i].acc_balance/10;

    maxWithdraw=maxWithdraw*10-100;

    if(maxWithdraw < 0)

    maxWithdraw = 0;

    int withdraw;

    do{

        system("cls");

        cout << "Each transaction will charge
RM0.50" << endl;

        cout << "The balance is RM" <<
database[i].acc_balance << endl

             << "The
maximum amount that can withdraw is: RM"

             <<
maxWithdraw << endl << "How much to withdraw? (0 to exit) : RM";

        string temp;

        getline(cin, temp);

        if(temp == "0")//for exit

        return 0;

        withdraw =
Account::s_to_n_convert(temp);//convert string to int

        if(withdraw > maxWithdraw)//for
withdrawal that exceed the balance

        {

            cerr << "\aDebit
amount exceed max withdraw amount.\n";

            system("Pause");

        }

        else if(withdraw == 0)//for invalid
ammount that key in

        {

            cerr << "\aInvalid
withdraw amount!\n";

            system("Pause");

        }

    }while(withdraw > maxWithdraw||withdraw == 0);

    return database[i].acc_balance-=withdraw;//to get the balance
after withdraw

}



int AccountRead::deposit()

{

    system("cls");

    int x = AccountRead::read_file(1);//to read the file

    if(x == 0)//if there is no records in the textfile

    {

        cerr << "\aNo Records Found!\n";

        system("pause");

        return 0;

    }

    int i;

    do{

        system("cls");

        i = AccountRead::search(x);//to
search the record

        if(i == 1000)

        return 0;

    }while(i >= 1000);

    float deposit;

    do{

        system("cls");

        cout << "The balance is RM" <<
database[i].acc_balance << endl

             << "How
much to deposit? (0 to exit): RM";

        string temp;

        getline(cin, temp);//input amount to
deposit

        if(temp == "0")//to exit

        {

            cerr << "\aTransaction
Cancelled!\n";

            system("Pause");

            return 0;

        }

        deposit =
Account::s_to_f_convert(temp);//convert string into float

        if(deposit == 0)//for invalid input

        {

            cerr << "\aInvalid
amount, please key in again!\n";

            system("Pause");

        }

    }while(deposit==0);

    database[i].acc_balance+=deposit;//get the balance after
deposit

    ofstream write;//rewrite the account.txt

    write.open("Account.txt", ios::out);

    for(int j = 0; j < x; j++)

    {

        write << database[j].acc_no << ";"


             
<< database[j].acc_type << ";"

             
<< database[j].acc_name1 << ";"

             
<< database[j].acc_ic1 << ";"

             
<< database[j].acc_contactNo1 << ";"

             
<< database[j].acc_address1 << ";"

             
<< database[j].acc_name2 << ";"

             
<< database[j].acc_ic2 << ";"

             
<< database[j].acc_contactNo2 << ";"

             
<< database[j].acc_address2 << ";"

             
<< database[j].acc_balance << ";" <<endl;

    }

    write.close();

    cout << "Transaction Sucess!!!\n";

    system("Pause");

    return 0;

}



class CheckingAccount : protected AccountRead

{

    private:

        float transactionFee;

        float countFee(float balance);

       

    public:

        CheckingAccount():
transactionFee(0.5){};

        int deposit();

        int withdraw();

};



int CheckingAccount::deposit()

{

    AccountRead::deposit();

    return 0;

}



int CheckingAccount::withdraw()

{

    system("cls");

    int x = AccountRead::read_file(1);//to read the file

    if(x == 0)//if there is no records in the textfile

    {

        cerr << "\aNo Records Found!\n";

        system("pause");

        return 0;

    }

    int i;

    do{

        system("cls");

        i = AccountRead::search(x);//to
search the record

        if(i == 1000)

        return 0;

    }while(i >= 1000);

    //system("cls");



    database[i].acc_balance=AccountRead::withdraw(i);

    if(database[i].acc_balance == 0)

    {

        cout << "\aTransaction Cancelled!\n";


        system("Pause");

        return 0;

    }

    database[i].acc_balance=CheckingAccount::countFee(database[i].acc_balance);

    ofstream write;//rewrite the account.txt

    write.open("Account.txt", ios::out);

    for(int j = 0; j < x; j++)

    {

        write << database[j].acc_no << ";"


             
<< database[j].acc_type << ";"

             
<< database[j].acc_name1 << ";"

             
<< database[j].acc_ic1 << ";"

             
<< database[j].acc_contactNo1 << ";"

             
<< database[j].acc_address1 << ";"

             
<< database[j].acc_name2 << ";"

             
<< database[j].acc_ic2 << ";"

             
<< database[j].acc_contactNo2 << ";"

             
<< database[j].acc_address2 << ";"

             
<< database[j].acc_balance << ";" <<endl;

    }

    write.close();

    cout << "Transaction Sucess!!!\n";

    system("Pause");

    return 0;

}



float CheckingAccount::countFee(float balance)

{

    balance = balance - transactionFee;

    return balance;

}



class SavingAccount : public AccountRead , public date

{

    private:

        int year, month, day, hour, minute,
sec;

        string dayofweek;

        float interest;





    public:

        SavingAccount():interest(6.25){}

        void calculateInterest();

        void read_date();

        void trigger();

        void displayLast();

        void selectday(int day);

        void renewdate();

};



void SavingAccount::calculateInterest()

{

    int index = AccountRead::read_file(2);

    for(int i = 0; i < index; i++)

    {

        double x = database[i].acc_balance*(interest/100);

        database[i].acc_balance+=x;

    }

    ofstream write;//rewrite the account.txt

    write.open("Account.txt", ios::out);

    for(int j = 0; j < index; j++)

    {

        write << database[j].acc_no << ";"


             
<< database[j].acc_type << ";"

             
<< database[j].acc_name1 << ";"

             
<< database[j].acc_ic1 << ";"

             
<< database[j].acc_contactNo1 << ";"

             
<< database[j].acc_address1 << ";"

             
<< database[j].acc_name2 << ";"

             
<< database[j].acc_ic2 << ";"

             
<< database[j].acc_contactNo2 << ";"

             
<< database[j].acc_address2 << ";"

             
<< database[j].acc_balance << ";" <<endl;   

    }   

    write.close();

}



void SavingAccount::read_date()

{

    date::setdate();

    ifstream read ("Login.txt", ios::in);

    char temp[255];

    if(read.fail()==1)

    {

        ofstream write ("Login.txt", ios::out);

        write << date::year << ";" <<
date::month << ";" << date::day << ";"

             
<< date::hour << ";" << date::minute << ";" << date::sec << ";"

             
<< date::dayofweek << ";";

    }

    else

    read.getline(temp,255, ';');

    year = atoi(temp);

    read.getline(temp,255, ';');

    month = atoi(temp);

    read.getline(temp,255, ';');

    day = atoi(temp);

    read.getline(temp,255, ';');

    hour = atoi(temp);

    read.getline(temp,255, ';');

    minute = atoi(temp);

    read.getline(temp,255, ';');

    sec = atoi(temp);

    read.getline(temp,255, ';');

    dayofweek = temp;

    read.close();

}



void SavingAccount::trigger()

{

    SavingAccount::read_date();

    date::setdate();

    if (year < date::year)

    SavingAccount::calculateInterest();

    SavingAccount::renewdate();

}



void SavingAccount::displayLast()

{

    SavingAccount::read_date();

    cout << dayofweek << ", ";

    if(day < 10)

    cout << "0" << day << "-";

    else

    cout << day << "-" ;



    if(month < 10)

    cout << "0" << month << "-";

    else

    cout << month << "-" ;



    cout << year << ", ";



    if(hour < 10)

    cout << "0" << hour << ":";

    else

    cout << hour << ":" ;

   

    if(minute < 10)

    cout << "0" << minute << ":";

    else

    cout << minute << ":" ;

   

    if(sec < 10)

    cout << "0" << sec << endl;

    else

    cout << sec << endl;


}



void SavingAccount::renewdate()

{

    ofstream write ("Login.txt", ios::out);

    write << date::year << ";" << date::month << ";" << date::day
<< ";"

          << date::hour << ";" <<
date::minute << ";" << date::sec << ";"

          << date::dayofweek <<
";";

}



int main(int argc, char *argv[])

{





    system("color 4F");

    int x = 1;

    SavingAccount SA;

    CheckingAccount CA;

    SA.trigger();

    while(x != 5)

    {

        system("cls");

        string respond;

        int answer;

       

        cout <<"Welcome to NERV Banking
System v1.1" << endl;

        cout <<"You logged in at ";

        SA.displayLast();

        cout << "Please select a service: "
<< endl

             << "1.
Register New Account" << endl

             << "2.
Check Account Detials" << endl

             << "3.
Desposit Money" << endl

             << "4.
Withdraw Money" << endl

             << "5.
Exit System (Logout)" << endl

             <<
"Please enter your choice: ";

        getline(cin,respond);

        x = SA.s_to_n_convert(respond);

        switch (x)

        {

            case 1:

               
{

                   
int index = SA.read_file(1);

                   
SA.input_data(index, SA.database[index-1].acc_no);break;

               
};

            case 2:
SA.display_data(2);break;

            case 3:
SA.deposit(); break;

            case 4:
CA.withdraw();break;

            case 5: break;

            default:

               
{

                   
cerr << "\aInvalid choice, please try again\n";

                   
system("Pause");

                   
break;

               
};

        }

    };

    //system("Pause");

    return EXIT_SUCCESS;

}

 


Total: 870 lines ^_^

Tuesday, December 20, 2005

AHHHHHH I NEED A REST!!!!!!!!!!!!!!!!

hmm, i think most of u know that i really bz for these few days, that the main reason that i "MIA" from my blog.
will try to blog abt all things that happen in these few week maybe by this x'mas (if i can finish my computer programming assignment 2 >_<)

things that keep me bz currently:-
1. Academic matters
- stupid lecture that i have let me having a hard timein studying
- super damn assignment that come straight after the previous just submit
- all my mid-terms are within 5 days.
2. GACC (Games Anime Comic Circle)
- stuff happen, yeah is a lot.

Thursday, December 01, 2005

A$$ignment 1

Well, until now not sure that want to blog abt what. Guess i post the "ersult" hrhar i had done for the last whole weeks.

WARNING: PLease do not try to compile it in ur brain, since will let ur brain went overload. As a recommend use Dev C++ version 4.9.8.0 and above


// TCP1241 Assignment 1 Trimester 2 2005/2006
// Done by Choo Chia Poh, Teo Leong Kim, Tan Hsia-Liang
//Copy of the code is prohibited, All Right Reserved

#include <.iostream>
#include <.fstream>
#include <.string>
#include <.cstring>
#include <.conio.c>
#include <.stdlib.h>

using namespace std;
struct cust{
char username[255];
char password[255];
char name[255];
char ic[255];
char contact_no[255];
char address[255];
};

struct book{
char book_code[255];
char pass_name[255];
char pass_ic[255];
char flight_code[255];
char promo_code[255];
char tax[255];
char card_no[255];
int commit;
};

struct promo{
char promo_code[255];
char flight_code[255];
char seats_left[255];
char promo_price[255];
};

struct sche{
char flight_code[255];
char from[255];
char destination[255];
char date[255];
char time[255];
char price[255];
char seats_left[255];
};

void load_cust();
void load_book();
void load_promo();
void load_sche();
void login();
void menu1();
void menu2();
void add_entry();
void add_entry2();
void display_entry();
void display_entry2();
void add_user();
void add_book();
void modify_book();
void display_sche();
void display_book();
void add_book();
void write_entry();
void edit_pass_name(int);
void edit_card_no(int);
void edit_flight_code(int);
void edit_pass_ic(int);
void edit_promo_code(int);
void write_book();
void delete_entry();
void print();
void splash();
cust detial[30];
book book_detail[30];
promo promo_detail[30];
sche sche_detail[30];
book add_detial[1];


//Universal Variable for Login System===========================================
int total_index;
int index;
//==============================================================================

//Universal Variable for User Registration======================================
string username;
string password;
string password2;
string ic;
string contact;
string cust_name;
string address;
//==============================================================================

//Universal Variable for Modify System==========================================
int book_index;
//==============================================================================

//Universial Variable for flight timetable======================================
int sche_index;
//==============================================================================

//Universial Variable for Promo code checking===================================
int promo_index;
//==============================================================================

//Main Function=================================================================
int main()
{
splash();
menu1();
menu2();
system("Pause");
return 0;
}
//==============================================================================

//Menu 1 =======================================================================
void menu1()
{
int choice = 1;
while(choice!=0)
{
clrscr();
gotoxy(20, 5);
cout << "Welcome to Air Asia Online Reservation System" <<>> choice;
if(choice<1||choice>3)
gotoxy(27,15);
cerr << "Invalid choice, please retry again."; }while(choice<1||choice>3);

switch(choice)
{
case 1: clrscr(); login(); cin.ignore(); break;
case 2: clrscr(); add_user(); cin.ignore(); break;
case 3: clrscr(); exit(1); cin.ignore(); break;
}
}
}
//==============================================================================

//Menu 2========================================================================
void menu2()
{

int choice = 1;
while(choice!=0)
{
clrscr();
gotoxy(23, 3);
cout << "Welcome Mr./Ms. " <<>> choice;
if(choice<1||choice>7)
gotoxy(24, 20);
cerr << "Invalid choice, please retry again."; }while(choice<1||choice>7);
switch(choice)
{
case 1: clrscr(); add_book() ; cin.ignore(); break;
case 2: clrscr(); modify_book(); cin.ignore(); break;
case 3: clrscr(); delete_entry(); cin.ignore(); break;
case 4: clrscr(); display_sche(); cin.ignore(); break;
case 5: clrscr(); display_book() ; cin.ignore(); break;
case 6: clrscr(); print(); cin.ignore(); break;
case 7: clrscr(); menu1(); cin.ignore(); break;
}
}
}
//==============================================================================

//Loading function(customer.txt)================================================
//To load the customer.txt into the array
void load_cust()
{
string temp;
ifstream file_op("customer.txt", ios::in);
int i=0;
while (!file_op.eof())
{
file_op.getline(detial[i].username, 255, ';');
temp = detial[i].username;
temp.erase(0,1);
strcpy(detial[i].username, temp.c_str());

file_op.getline(detial[i].password, 255, ';');
temp = detial[i].password;
temp.erase(0,1);
strcpy(detial[i].password, temp.c_str());

file_op.getline(detial[i].name, 2000, ';');
temp = detial[i].name;
temp.erase(0,1);
strcpy(detial[i].name, temp.c_str());

file_op.getline(detial[i].ic, 2000, ';');
temp = detial[i].ic;
temp.erase(0,1);
strcpy(detial[i].ic, temp.c_str());

file_op.getline(detial[i].contact_no, 2000, ';');
temp = detial[i].contact_no;
temp.erase(0,1);
strcpy(detial[i].contact_no, temp.c_str());

file_op.getline(detial[i].address, 2000, ';');
temp = detial[i].address;
temp.erase(0,1);
strcpy(detial[i].address, temp.c_str());

i++;
}
total_index = i;

file_op.close();
}
//==============================================================================

//Loading function(booking.txt)=================================================
//To load the booking.txt into the array
void load_book()
{
string temp;
ifstream file_op("booking.txt", ios::in);
int i=0;
while (!file_op.eof())
{
file_op.getline(book_detail[i].book_code, 255, ';');
temp = book_detail[i].book_code;
temp.erase(0,1);
strcpy(book_detail[i].book_code, temp.c_str());

file_op.getline(book_detail[i].pass_name, 255, ';');
temp = book_detail[i].pass_name;
temp.erase(0,1);
strcpy(book_detail[i].pass_name, temp.c_str());

file_op.getline(book_detail[i].pass_ic, 255, ';');
temp = book_detail[i].pass_ic;
temp.erase(0,1);
strcpy(book_detail[i].pass_ic, temp.c_str());

file_op.getline(book_detail[i].flight_code, 255, ';');
temp = book_detail[i].flight_code;
temp.erase(0,1);
strcpy(book_detail[i].flight_code, temp.c_str());

file_op.getline(book_detail[i].promo_code, 255, ';');
temp = book_detail[i].promo_code;
temp.erase(0,1);
strcpy(book_detail[i].promo_code, temp.c_str());

file_op.getline(book_detail[i].tax, 255, ';');
temp = book_detail[i].tax;
temp.erase(0,1);
strcpy(book_detail[i].tax, temp.c_str());

file_op.getline(book_detail[i].card_no, 255, ';');
temp = book_detail[i].card_no;
temp.erase(0,1);
strcpy(book_detail[i].card_no, temp.c_str());

book_detail[i].commit = 0;
i++;
}
book_index = i;
file_op.close();
}
//==============================================================================

//Loading function(promotion.txt)===============================================
//To load the promotion.txt into the array
void load_promo()
{
string temp;
ifstream file_op("promotion.txt", ios::in);
int i=0;
while (!file_op.eof())
{
file_op.getline(promo_detail[i].promo_code, 255, ';');
temp = promo_detail[i].promo_code;
temp.erase(0,1);
strcpy(promo_detail[i].promo_code, temp.c_str());

file_op.getline(promo_detail[i].flight_code, 255, ';');
temp = promo_detail[i].flight_code;
temp.erase(0,1);
strcpy(promo_detail[i].flight_code, temp.c_str());

file_op.getline(promo_detail[i].seats_left, 255, ';');
temp = promo_detail[i].seats_left;
temp.erase(0,1);
strcpy(promo_detail[i].seats_left, temp.c_str());

file_op.getline(promo_detail[i].promo_price, 255, ';');
temp = promo_detail[i].promo_price;
temp.erase(0,1);
strcpy(promo_detail[i].promo_price, temp.c_str());

i++;
}
promo_index = i;
file_op.close();
}
//==============================================================================

//Loading function(schedule.txt)===============================================
//To load the schedule.txt into the array
void load_sche()
{
string temp;
ifstream file_op("schedule.txt", ios::in);
int i=0;
while (!file_op.eof())
{
file_op.getline(sche_detail[i].flight_code, 255, ';');
temp = sche_detail[i].flight_code;
temp.erase(0,1);
strcpy(sche_detail[i].flight_code, temp.c_str());

file_op.getline(sche_detail[i].from, 255, ';');
temp = sche_detail[i].from;
temp.erase(0,1);
strcpy(sche_detail[i].from, temp.c_str());

file_op.getline(sche_detail[i].destination, 255, ';');
temp = sche_detail[i].destination;
temp.erase(0,1);
strcpy(sche_detail[i].destination, temp.c_str());

file_op.getline(sche_detail[i].date, 255, ';');
temp = sche_detail[i].date;
temp.erase(0,1);
strcpy(sche_detail[i].date, temp.c_str());

file_op.getline(sche_detail[i].time, 255, ';');
temp = sche_detail[i].time;
temp.erase(0,1);
strcpy(sche_detail[i].time, temp.c_str());

file_op.getline(sche_detail[i].price, 255, ';');
temp = sche_detail[i].price;
temp.erase(0,1);
strcpy(sche_detail[i].price, temp.c_str());

file_op.getline(sche_detail[i].seats_left, 255, ';');
temp = sche_detail[i].seats_left;
temp.erase(0,1);
strcpy(sche_detail[i].seats_left, temp.c_str());

i++;
}
sche_index = i;
file_op.close();
}
//==============================================================================

//Login=========================================================================
//The login function for the system

void login()
{
load_cust();//load customer textfile to memory
int ch, i;
char username[255];
cin.ignore();
//for username
for(int chance = 0; chance <3; i =" 0;" i="0;" result =" 0;" result =" 2;" result ="="" result ="="" result ="="" chance ="="" index =" i;//to" chance =" 0;">> password;
int result;
if(strcmp(detial[index].password,password)==0)
result = 0;
else
result = 2;
if(result == 2 && chance <= 1) { gotoxy(24,20); cerr << "Password incorrect!"; } else if(result == 2 && chance == 2) { gotoxy(16,20); cerr << "Invalid password have key in, program exiting....."; getch(); exit(1); } else if (result == 0) break; }; system("cls"); menu2(); } //============================================================================== //User Registration============================================================= void add_user() { char answer, answer2; ofstream read("customer.txt", ios::out|ios::app); do{ do{ clrscr(); add_entry(); clrscr(); display_entry(); gotoxy(20, 17); cout << "Are the details above are correct? (Y/N): "; cin >> answer;
if(answer=='n'||answer=='N')
{
gotoxy(20, 17);
cout << "Do you want to reenter your entry? (Y/N): "; cin >> answer2;
}
else if(answer=='y'||answer=='Y')
{
read <<>> username;
password = 'asd';
password2 = 'wewqe';
cin.ignore();
while (password != password2)
{

cout << "Please enter a password: "; cin >> password;

cout <<"Please enter the password again: "; cin >> password2;
if(password != password2)
{
cout << "Both password are unmatch, please enter the password again.\n"; } }; cin.ignore(); cout << "Please enter your name: "; getline(cin,cust_name); cout << "Please enter your IC No.: "; cin >> ic;

cout << "Please enter your contact number: "; cin >> contact;

cin.ignore();
cout << "Please enter your address: "; getline(cin,address); } //============================================================================== //User Registration (Display)=================================================== void display_entry() { gotoxy(24, 5); cout << "Username : " << booking="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="" entry="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="" temp4 =" 0;" temp3="1;" temp =" atoi(book_detail[book_index-2].book_code);" i ="0;" temp =" strcmp(add_detial[0].flight_code,sche_detail[i].flight_code);" temp="="0)" i ="0;" temp =" strcmp(add_detial[0].promo_code,promo_detail[i].promo_code);" temp="="0)" temp2 =" i;" temp3="strcmp(add_detial[0].flight_code,promo_detail[temp2].flight_code);" temp4 =" atoi(promo_detail[temp2].seats_left);" temp =" 1;" temp="="1)" entry="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="">> answer;
if (tolower(answer)!='y'&& tolower(answer)!='n')
gotoxy(16,20);
cout << "You have enter a invalid respond, please try again\n"; }while(tolower(answer)!='y'&& tolower(answer)!='n'); } //============================================================================== //Write booking entry to text file============================================== void write_entry() { ofstream write("booking.txt", ios::out|ios::app); write << booking="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="" i =" 1;" temp =" i;">> num;
if (num<1||num>temp)
cout << "Invalid choice, please retry again."; } while (num<1||num>temp);

do{
clrscr();
cout << "Please choose the attribute that you want to edit:" <<>> choice;
if(choice<1||choice>6)
cerr << "Invalid choice, please retry again."; }while(choice<1||choice>6);
switch(choice)
{
case 1: clrscr(); edit_pass_name(num); break;
case 2: clrscr(); edit_pass_ic(num); break;
case 3: clrscr(); edit_flight_code(num); break;
case 4: clrscr(); edit_promo_code(num); break;
case 5: clrscr(); edit_card_no(num); break;
case 6: clrscr(); write_book();menu2(); break;
};
}while(choice != 8);
}
//==============================================================================

//Edit pass_name================================================================
void edit_pass_name(int num)
{
cin.ignore();
char temp[255];
//cout << card_no="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="" flight_code="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="" i ="0;" temp =" strcmp(book_detail[num].flight_code,sche_detail[i].flight_code);" temp="="0)" pass_ic="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="" promo_code="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="" temp4 =" 0;" temp3="1;" i ="0;" temp =" strcmp(book_detail[num].promo_code,promo_detail[i].promo_code);" temp="="0)" temp2 =" i;" temp3="strcmp(book_detail[num].flight_code,promo_detail[temp2].flight_code);" temp4 =" atoi(promo_detail[temp2].seats_left);" temp =" 1;" temp="="1)" txt="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="" i =" 0;" detial="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="" j =" 0;" k =" 0;" i =" 1;" i =" 0;" timetable="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="" i =" 1;" entry="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="" i =" 1;" temp =" i;">> num;
if (num<1||num>temp)
cout << "Invalid choice, please retry again.\n"; } while (num<1||num>temp);

book_detail[num].commit = 1;

ofstream write("booking.txt", ios::out);
write << "B"; for (int i = 0; i < commit ="="" print="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="="" i =" 0;" j =" 1;">> respond;

//To get the ticket price
check3 = strcmp(temp_arr[respond].promo_code,"0");
if(check3 == 0)
{
for(int i = 0; i < check="strcmp(temp_arr[respond].flight_code,sche_detail[i].flight_code);" check ="="0)" temp1 =" atof(sche_detail[i].price);" i =" 0;" check="strcmp(temp_arr[respond].flight_code,promo_detail[i].flight_code);" check ="="0)" temp1 =" atof(promo_detail[i].promo_price);" i =" 0;" check2 ="strcmp(temp_arr[respond].flight_code,sche_detail[i].flight_code);" check2="="0)">***********<> " << endl;
cout << " ******** " << endl;
cout << " ****** " << endl;
cout << " **** " << endl;
cout << " ** " << endl;
cout << " * " << endl << "\n";
cout << " ~~~~ Now Everyone Can Fly ~~~~";
getch();
}