Sunday, May 20

Programming Technique...

hy sume,, pe cite chik skrg? haha,,, biase la, chik bz la,, skrg nie pn tgh pening kple, slalu je tido kol 6 ataupun 7 pg utk siapkan project dll... nie cntoh project yg chik buat, simple je p lau nak buat nie mesti kena ada codeblock..hehe,, bkn visual basic k.. :)


nie utk customer msukkan info n bla bla bla... ^


nie lak output bila admin nak bkak pe yg customer order :) ^

amboiii,,,dh tgk output utk customer n admin, skunk nie jom tgk coding dye lak,,msti kowang pening, so xnk pening, sila la copy paste kt codeblock anda sndri, try ye :)

==================ok start coding kt bwh nie ok :)====================

#include<stdio.h>
#include<stdlib.h>
#include<time.h>

int booking(); // function prototype/ function declaration

int main()
{
    int a;

    a=booking(); // calling a function
    return 0;
}

int booking() // define a function
{
    //declaration for time
    char currentime[20];
    char date[20];
    time_t clock;
    struct tm*timeinfo, ftimeinfo;
    int total=0;


    //declaration for info
    int selection;
    int a, i, x, y, z, buy, how_much, pickup, sure, see;
    char name[2][20];
    char address[3][20];
    char phone_num[11];

    do
   {
    menu:
    system("cls");

    printf("\n\nChoose want you want to order\n\n");
    printf("\n 1 = Tat Tulip : RM25");
    printf("\n 2 = Tat Nenas : RM18");
    printf("\n 3 = Almond London : RM25");
    printf("\n 4 = Semperit Cip : RM17");
    printf("\n 5 = Biskut Dam : RM15");
    printf("\n\nHow many you want to order?\t");//Input
    scanf("\n%i",&how_much);
    int c=how_much;

    for(i=1;i<=c;i++)
    {
    printf("\nPlease insert the no.%d order:",i);
    scanf("%d",&selection);

    //switch
   switch (selection)
    {
        case 1 :
        printf("Tat Tulip\tRM25\n");
        total=total+25;

        break;

        case 2 :
        printf("Tat Nenas\tRM18\n");
        total=total+18;
        break;

        case 3 :
        printf("Almond London\tRM25\n");
        total=total+25;
        break;

        case 4 :
        printf("Semperit Cip\tRM17\n");
        total=total+17;
        break;

        case 5 :
        printf("Biskut Damn\tRM15\n");
        total=total+15;
        break;

        default:goto menu;
    }
    }
        printf("\n\nTotal is =RM%d",total); //total how much customer
        printf("\n\n<1 for cash, 2 for card credit, 3 for check>");
        printf("\nDo you want buy with : ");
        scanf("%d", &buy);

        //if else for want to buy with what
        if (buy == 1)
        {
            printf("cash", buy);
        }
        else if (buy == 2)
        {
            printf("card credit", buy);
        }
        else
        {
            printf("check", buy);
        }

        //customer key in info for booking order
        printf("\n===========Customer Information======\n", i+1);
        fflush(stdin);
        printf("\nName : ");
        gets(name[20]);
        printf("\nAddress : ");
        gets(address[20]);
        printf("\nPhone No : ");
        scanf("%s", &phone_num);
        printf("\nOrder Date : ");
        time ( &clock);
        timeinfo = localtime( &clock);
        strftime(currentime, 20, "%I:%M %p", timeinfo);
        printf("\n\nTime :%s", currentime);
        strftime(date, 20, "%x", timeinfo);
        printf("\n\nDate : %s\n\n", date);
        printf("\nPick Up Date/Delivery : ");
        scanf("\n%i", &pickup);

        //file operation for read and write
        FILE *input; //declaration for file
        input = fopen("FileReceipt.txt", "w"); // create a file for each customer

        //Output for receipt  - output
        fprintf(input, "\n\n******************************************\n\n");
        fprintf(input, "\t\t\tAMIRAH ENTERPRISE\n");
        fprintf(input, "\t\t\tLot Pt 3798, Tmn Desa Melati,\n");
        fprintf(input, "\t\t\tJln Sedek Sg Durian,\n");
        fprintf(input, "\t\t\t18000 Kuala Krai,\n");
        fprintf(input, "\t\t\tKelantan.\n\n\n");
        fprintf(input, "  ");
        fprintf(input, "\nName : %s",name[20]);
        fprintf(input, "\nAddress : %s", address[20]);
        fprintf(input, "\nPhone No : %s", phone_num);
        fprintf(input, "\nOrder Date : ");
        time (&clock);
        timeinfo = localtime(&clock);
        strftime(currentime, 20, "%I:%M %p", timeinfo);
        fprintf(input, "\n\nTime :%s", currentime);
        strftime(date, 20, "%x", timeinfo);
        fprintf(input, "\nPickup Date/Delivery : %i", pickup);
        fprintf(input, "\nDo you want buy with : %i \t<1 for cash, 2 for credit card, 3 for check>", buy);
        fprintf(input, "\nOrder Booking : %c", selection);
        fprintf(input, "\nTotal : RM%d", total);

        printf("\nFileReceipt.txt has been succesfully created.");
        fclose(input); //close the file if all info successfully created

        printf("\n< 1 for see, 2 for dont want>");
        printf("\n\nDo you want to see your receipt?");// customer want to look what her buy
        scanf("%i", &see);
        if (see == 1)
        {
        printf("\n\n******************************************\n\n");
        printf("\t\t\tAMIRAH ENTERPRISE\n");
        printf("\t\t\tLot Pt 3798, Tmn Desa Melati,\n");
        printf("\t\t\tJln Sedek Sg Durian,\n");
        printf("\t\t\t18000 Kuala Krai,\n");
        printf("\t\t\tKelantan.\n\n\n");
        printf("  ");
        printf("\nName : %s",name[20]);
        printf("\nAddress : %s", address[20]);
        printf("\nPhone No : %s", phone_num);
        printf("\nOrder Date : ");
        time (&clock);
        timeinfo = localtime(&clock);
        strftime(currentime, 20, "%I:%M %p", timeinfo);
        printf("\n\nTime :%s", currentime);
        strftime(date, 20, "%x", timeinfo);
        printf("\nPickup Date/Delivery : %i", pickup);
        printf("\nDo you want buy with : %i \t<1 for cash, 2 for credit card, 3 for check>", buy);
        printf("\nOrder Booking : %c", selection);
        printf("\nTotal : RM%d", total);
        }
        else
        {
            printf("Okay :)");
        }

        //ask customer for continue or not, if want customer can click 1
        printf("\n\nYou want to change?");
        printf("0=Yes, 1=No");
        switch(sure)
        {
            case 1 :
            printf("Yes");
            break;

            case 2 :
            printf("No");
            break;
        }

        printf("\n\nAre you sure?");
        scanf("%i", &z);

        if (z==1) break;

        }while (z==0);

    getch();
    return 0;
}

 =========dh2 la, nie je coding yg chik buat,, hehe >.<==============
ckup la ye ckit nie,,, byk lg yg kn knew buat... bye, jmpa nati ya sume :)


Monday, May 14

A Story Of A Mother & Her Son

hy.. i hving story, btw this not my story,,, share only... :)

"**********************************************************"
My mum only had one eye, I hated her, she was such an embarrassment.  She cooked for students n teachers to support the family. 

There was this one day, during elementary school, where my mum came to say "Hello" to me.  I was so embarrassed.  How could she do this to me?  I ignored her, threw her a hateful look n ran out.

The next day at school one of my classmates said : "Uhh, your mum only has one eye!?.  I wanted to bury myself.  I also wanted my mum to just disappear.

So, I confronted her that day n said :"If  you're only going to make me a laughing stock, why dont you just die?"  My mum didn't respond.  I didn't even stop to think for a second about what I had said, because I was full of anger.

I was oblivious to her feelings.  I wanted out of that house.  So I studied real hard, got a chance to go to Singapore to study.  Then I got married.  I bought a house of my own.  I had kids of my own.  I was happy with my life.

Then one day, my mother came to visit me.  She hadn't seen me in years and she didn't even meet her grandchildren.  When she stood by the door, my children were frightened, they cried when they saw her.

I shouted at my mother "How dare you come to my house and scare my children? Get out of here now!"  And to this my mother quietly answered, "Oh, I'm so sorry.  I may have gotten the wrong address" and saying that, she left.

One day, a letter regarding a school reunion came to my house.  So I lied to my wife and said that I was going to a business trip.  After the reunion, went to my mothers house just out of curiosity.  My neighbours said that she had died.

I didn't shed a singer tear!  They handed me a letter, that she had wanted me to have. The letter said : "My dearest son, I think of you all time.  I'm sorry that I came to Singapore and scared your children.  I was so glad when I heard you were coming for the reunion.  But I may not be able to even get out of bed to see you.  I'm sorry that I was a constant embarrassment to you when you were growing up.  you see, when you were little, you got into an accident, and you lost a eye.  As a mother, I couldn't stand watching you having yo grow up with one eye.  So, I gave you MINE... I was so proud of my son who was seeing a whole new world for me in my place, with the eye. With my love to you Your Mother"

That's all from me :)


I LOVE MY MUM <3
"***********************************************"