hai teman teman SMK MUHAMMADIYAH kudus...
ini tugas pak yudis yang mirip soal UKP saya share...
mohon jangan di edit, tolong menghormati yang membuat ya...
thank's :)
jangan lupa Comment yah...
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
char id[100] = "admin";
char pass[100] = "admin";
char bakpao[100] = "bakpao";
char lumpia[100] = "lumpia";
char pempek[100] = "pempek";
char user[100];
char pswd[100];
char acfa[50];
char pupe[100];
int j, h, d, t;
printf("id = ");
gets(user);
printf("pass = ");
gets(pswd);
if(strcmp(user,id) == 0 && strcmp(pswd,pass) == 0)
{
awal:
clrscr();
printf("selamat datang di cibleg\n");
printf("Masukan Nama Barang = ");
gets(acfa);
if(strcmp(acfa,bakpao) == 0)
{
printf("Jumlah pembelian = ");
scanf("%d",&j);
h=12000*j;
printf("Nama pembeli = ");
scanf("%s",&pupe);
}
else if(strcmp(acfa,lumpia) == 0)
{
printf("Jumlah pembelian = ");
scanf("%d",&j);
h=10000*j;
printf("Nama pembeli = ");
scanf("%s",&pupe);
}
else if(strcmp (acfa,pempek) == 0)
{
printf("Jumlah pembelian = ");
scanf("%d",&j);
h=15000*j;
printf("Nama pembeli = ");
scanf("%s",&pupe);
}
else
{
printf("Salah input, silahkan masukan masukan lagi");
getch();
goto awal;
}
printf("-------------------------------\n");
printf("Harga = %d\n",h);
if(h < 50000)
{
d=h*10/100;
}
else if(h > 50000)
{
d=h*20/100;
}
else
{
d=0;
}
printf("Diskon = %d\n",d);
t=h-d;
printf("Total harga = %d\n",t);
printf("Terimakasih %s",pupe);
getch();
}
else
{
}
}
6 comments