Get the FREE certificate on C, C++, Java, Python, Perl, PHP, SQL, Linux & Javascript!  

CppBuzz.com
  
Home C C++ Java Python Perl PHP Spring SQL Javascript Linux

C Program on Menu (Menu Driven Program on C)

echo "
"; echo "

You are here : Home » C program on menu

"; echo "
";
         

#include <stdio.h> #include <stdlib.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ void menu(); void promo(); void beli(); void list(); void data(); void data() { char kode[7]; float harga,jumlah,total; } void main() { menu(); char pil='0'; while (pil='4') { pil=getche(); switch(pil) { case '1': break; case '2': beli(); case '3': list(); case '4': return 0; } } } void menu() { int i; char c[4][20]= { "Promo","Membeli","Daftar Motor","Exit" }; system("CLS"); printf("\nMENU DATA SISTEM INFORMASI MOTOR"); printf("\n-------------------------------------------------"); for(i=0;i<4;i++) { printf("\n[%d] %s",i+1,c[i]); } printf("\n-------------------------------------------------"); printf("\nPILIHAN : "); } void promo() { } void beli() { char nama[50]; char ktp[8]; char kerja[15]; char tempat[10]; char loop1; int tgl,input; //input data pembeli printf("\n__________________________________________________________________________\n"); printf("FORM DATA PEMBELI MOTOR\n"); printf("__________________________________________________________________________"); printf("\nNama\t\t\t\t=\t ");scanf("%s",&nama); printf("\nNo KTP\t\t\t\t=\t ");scanf("%s",&ktp); printf("\nPekerjaan\t\t\t=\t ");scanf("%s",&kerja); printf("\nTempat Lahir\t\t\t=\t ");scanf("%s",&tempat); printf("\nTanggal, Bulan, dan Tahun Lahir\t=\t ");scanf("%d",&tgl); printf("\n__________________________________________________________________________"); system("cls"); //output data pembeli printf("\n__________________________________________________________________________\n"); printf("FORM DATA PEMBELI MOTOR\n"); printf("__________________________________________________________________________"); printf("\nNama\t\t\t\t=\t%s",nama); printf("\nNo KTP\t\t\t\t=\t%s",ktp); printf("\nPekerjaan\t\t\t=\t%s",kerja); printf("\nTempat Lahir\t\t\t=\t%s",tempat); printf("\nTanggal, Bulan, dan Tahun Lahir\t=\t%d",tgl); printf("\n__________________________________________________________________________\n"); system("PAUSE"); main(); } void list() { int i; char motor[5][25]= { "jupiter", "mio", "ninja", "supra", "scoopy" }; int harga[5]= { 8000000,9000000,70000000,6000000,10000000 }; printf("\n__________________________________________________________________________\n"); printf("FORM DATA DAFTAR MOTOR\n"); printf("__________________________________________________________________________"); printf("\nNo.\tDaftar Motor\t\t\t\tHarga Motor\n"); for(i=0;i<=4;i++) { printf("\n%d\t%s\t\t\t\t\t%d\n",i+1,motor[i],harga[i]); } system("PAUSE"); main(); }

Compile C code here |  Upload your Questions

C Objective Questions By Different Categories :-
Preprocessor | Assembler | Compilation | Linking | Datatypes | Arrays | Variables | Pointers | Functions | Loops | Switch | Structures | Union | Enum | Goto & Labels | Storage Classes | Malloc & free | Macros | Conditional | Operators | File Handling | gcc | Others |

Switch to C++ Questions

Other links :

MCQ on C Programming  |  MCQ on C++ Programming  |  138+C++ F2F Interview Questions |  Basic Computer Questions |  Solved C programs  |  Solved C++ programs