This is default featured post 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

Tampilkan postingan dengan label program untuk membuat sebuah menu pilihan. Tampilkan semua postingan
Tampilkan postingan dengan label program untuk membuat sebuah menu pilihan. Tampilkan semua postingan

Senin, 05 Maret 2012

program untuk membuat sebuah menu pilihan

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

int main() {
    char c;
    for(c='1';c!='5'; ){
    /*agar pilihan diulang terus menerus mengunakan for diatas
      pilihan akan diulang hingga memilih pilihan no 5
      jika di beri system("cls"); maka pilihannya akan ditampilkan hanya
      beberapa saat kemudian pilihan akan hilang
      dan pilihan diulang hingga pilihan ke 5 */
    printf("**********MENU UTAMA**********\n");
    printf("==============================\n");
    printf("      1.Pisang Goreng\n");
    printf("      2.Pisang Bakar\n");
    printf("      3.Pisang Penyaet\n");
    printf("      4.Pisang Rebus\n");
    printf("      5.selesai\n");
    printf("==============================\n");
    printf("Pilihlah Salah Satu\n");
    //cuman bisa memilih salah satu jika memilih/menekan tombol lain maka tidak akan muncul
    printf("masukan angka 1-5:\n");
    for (c='0';c<'1'||c>'5'; ){
    /*c=0 karena nilai diluar 1-5
     char lebih dari/ sama dengan 1 sampai char kurang dari/ sama dengan 5
     dikosongkan karena pengulangan tidak bertambah/ berkurang*/
        c=getch();
        if(c>='1'&&c<='5')printf("%c",c);
        }
        printf("==============================\n");
    switch(c) {
              case '1' : printf(" pilihan anda pisang goreng\n"); break;
              case '2' : printf(" pilihan anda pisang Bakar\n"); break;
              case '3' : printf(" pilihan anda pisang Penyet\n"); break;
              case '4' : printf(" pilihan anda pisang Rebus\n"); break;
              case '5' : printf(" pilihan anda selesai\n"); break;
    /*switch untuk menganti pilihan jadi tulisan didalam case
    break untuk menyetop pilihannya*/
              }}

    printf("\n\n");
    system("pause");
    return(0);
}   

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More