Source Code :
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <conio.h> | |
#include <iostream.h> | |
#include <iomanip.h> | |
#include <windows.h> | |
void gotoxy (int x, int y) | |
{ | |
COORD fakhri; | |
fakhri.X = x; | |
fakhri.Y = y; | |
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),fakhri); | |
} | |
struct | |
{ | |
char kd[5],*merk; | |
int hrg,jml,total; | |
}motor[30]; | |
main() | |
{ | |
char nmsales[20],nm[20],lagi; | |
float tb=0; | |
int i,j; | |
awal: | |
system ("cls"); | |
gotoxy(17,1); | |
cout<<"SUMBER BERKAH MOTOR"<<endl; | |
cout<<"Jl. Pendidikan, KM.8 No. 11 Telp. 021-192.168.98.15"<<endl; | |
cout<<"===================================================="<<endl; | |
cout<<" Nama Sales : ";cin>>nmsales; | |
cout<<" Nama Pembeli : ";cin>>nm; | |
cout<<" Jumlah data : ";cin>>j; | |
for(i=1;i<=j;i++) | |
{ | |
cout<<" \n Data ke- "<<i<<endl; | |
cout<<" Kode [SPR/VRO/TGR] : ";cin>>motor[i].kd; | |
if(strcmp(motor[i].kd,"SPR")==0|| strcmp(motor[i].kd,"spr")==0) | |
{ | |
motor[i].merk="Supra X"; | |
motor[i].hrg=16540000; | |
} | |
else if(strcmp(motor[i].kd,"VRO")==0|| strcmp(motor[i].kd,"vro")==0) | |
{ | |
motor[i].merk="Vario"; | |
motor[i].hrg=15790000; | |
} | |
else if(strcmp(motor[i].kd,"TGR")==0|| strcmp(motor[i].kd,"tgr")==0) | |
{ | |
motor[i].merk="Tiger"; | |
motor[i].hrg=24940000; | |
} | |
else | |
{ | |
cout<<" Anda Salah Memasukkan Kode . . !!!, input Kode[SPR/VRO/TGR] . ."<<endl; | |
cout<<" Ingin Input Lagi : ";cin>>lagi; | |
if(lagi=='Y'||lagi=='y') | |
goto awal; | |
else | |
goto akhir; | |
} | |
cout<<" Masukan Jumlah Beli : ";cin>>motor[i].jml; | |
motor[i].total=motor[i].hrg*motor[i].jml; | |
tb=motor[i].total+tb; | |
} | |
system ("cls"); | |
gotoxy(23,1); | |
cout<<" S&D MOTOR"<<endl; | |
gotoxy(8,2); | |
cout<<"Jl. Sunan Wawan Beneran No. 38 Telp. 021-192.168.8.1"<<endl; | |
gotoxy(8,3); | |
cout<<"============================================================="<<endl; | |
cout<<"Nama Sales :"<<nmsales<<endl; | |
cout<<"Nama Pembeli :"<<nm<<endl; | |
cout<<"============================================================="<<endl; | |
cout<<"No. Kode Merk Harga Beli Jumlah Total "<<endl; | |
cout<<" Motor Motor "<<endl; | |
cout<<"============================================================="<<endl; | |
for(i=1;i<=j;i++) | |
{ | |
cout<<setiosflags(ios::left)<<setw(5)<<i; | |
cout<<setiosflags(ios::left)<<setw(6)<<motor[i].kd; | |
cout<<setiosflags(ios::left)<<setw(12)<<motor[i].merk; | |
cout<<setiosflags(ios::left)<<setw(14)<<motor[i].hrg; | |
cout<<setiosflags(ios::left)<<setw(10)<<motor[i].jml; | |
cout<<setiosflags(ios::left)<<setw(2)<<motor[i].total<<endl; | |
} | |
cout<<"============================================================="<<endl; | |
printf(" Total bayar Rp. %4.0f",tb); | |
cout<<endl; | |
cout<<"Mau Input data lagi[Y/T]:";cin>>lagi; | |
if (lagi=='Y'||lagi=='y') | |
goto awal; | |
else | |
goto akhir; | |
akhir: | |
getch(); | |
} |
1 komentar so far
sayangscriptnya tdk bisa di jalankan
Silahkan berkomentar yang sesuai dengan topik, Terima Kasih.
EmoticonEmoticon