Program c++ sudah termasuk input,output,kondisi,perulangan,array

2 Apr

#include”stdio.h”
#include”conio.h”
#include”string.h”
void main()
{
struct kursus
{
char np[10],nama[20],almt[20],krs[15],kls[10];
int kd;
}k[30];
char jwb;
int no=0,vbp=0,vbm=0,vjp=0,vjm=0,vcp=0,vcm=0,i=0;
do
{
clrscr();
i++;
printf(“Data Peserta ke %d\n”,i);
printf(“Masukkan Nomor Peserta [4 digit] :”;scanf(“%s”,k[i].np);
printf(“Masukkan Nama Peserta :”;scanf(“%s”,k[i].nama);
printf(“Masukkan Alamat Peserta :”;scanf(“%s”,k[i].almt);
printf(“Masukkan Kode Kursus [A/B/C/D/E/F] :”;scanf(“%s”,&k[i].kd);
switch (k[i].kd)
{
case ‘A’ :strcpy(k[i].krs,”Visual Basic”;
strcpy(k[i].kls,”Pagi”;
vbp++;
break;
case ‘B’ :strcpy(k[i].krs,”Visual Basic”;
strcpy(k[i].kls,”Malam”;
vbm++;
break;
case ‘C’ :strcpy(k[i].krs,”Visual Java”;
strcpy(k[i].kls,”Pagi”;
vjp++;
break;
case ‘D’ :strcpy(k[i].krs,”Visual Java”;
strcpy(k[i].kls,”Malam”;
vjm++;
break;
case ‘E’ :strcpy(k[i].krs,”Visual C++”;
strcpy(k[i].kls,”Pagi”;
vcp++;
break;
default :strcpy(k[i].krs,”Visual C++”;
strcpy(k[i].kls,”Malam”;
vcm++;
break;
}
printf(“\n\n\nProses Data Lagi [Y/N]:”;
jwb=getche();
}
while ((jwb==’Y’)||(jwb==’y’));

clrscr();
puts(” LPK ‘UNISBANK’ SEMARANG”;
puts(” JL.Menuju Nilai A”;
puts(“==================================================================”;
puts(“No. Nomor Peserta Nama Peserta Alamat Nama Kursus Kelas”;
puts(“==================================================================”;
for(no=1;no<=i;no++)
{
gotoxy(1,5+no);printf(“%d”,no);
gotoxy(5,5+no);printf(“%s”,k[no].np);
gotoxy(20,5+no);printf(“%s”,k[no].nama);
gotoxy(35,5+no);printf(“%s”,k[no].almt);
gotoxy(48,5+no);printf(“%s”,k[no].krs);
gotoxy(62,5+no);printf(“%s”,k[no].kls);
}
puts(“”;
puts(“==================================================================”;
printf(” Jumlah Peserta Kursus Visual Basic Pagi sebanyak : %3d orang\n”,vbp);
printf(” Jumlah Peserta Kursus Visual Basic Malam sebanyak : %3d orang\n”,vbm);
printf(” Jumlah Peserta Kursus Visual Java Pagi sebanyak : %3d orang\n”,vjp);
printf(” Jumlah Peserta Kursus Visual Java Malam sebanyak : %3d orang\n”,vjm);
printf(” Jumlah Peserta Kursus Visual C++ Pagi sebanyak : %3d orang\n”,vcp);
printf(” Jumlah Peserta Kursus Visual C++ Malam sebanyak : %3d orang\n”,vcm);
getch();
}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: