CONTOH CODING MENGGUNAKAN
BORLAND C++
CONTOH APLIKASI PENGAMBILAN
MATAKULIAH PADA MAHASISWA
#include <conio.h>
#include <stdio.h>
#include <stdio.h>
#include <iomanip.h>
main()
{
char npm [2][10];
char nama [2][20];
char kode [2][2][10];
char matkul [2][2][10];
int sks [2][2];
int total_sks=0;
int x,y;
cout<<"DAFTAR
PENGAMBILAN MATA KULIAH\n\n";
x=0;
while (x<2)
{
cout<<"DATA MAHASISWA -
"<<(x+1)<<endl;
cout<<"NPM :
";gets (npm[x]);
cout<<"NAMA
: ";gets (nama[x]);
y=0;
while (y<2)
{
cout<<"DATA MATAKULIAH - "<<(x+1)<<endl;
cout<<"KODE MATAKULIAH : ";gets (kode[x][y]);
cout<<"NAMA MATAKULIAH : ";gets (matkul[x][y]);
cout<<"SKS
: ";cin>>sks[x][y];
y=y+1;
}
cout<<endl;
x=x+1;
}
clrscr();
cout<<"DAFTAR PENGAMBILAN MATA KULIAH\n\n";
x=0;
while (x<2)
{
clrscr();
cout<<"DATA MAHASISWA -
"<<(x+1)<<endl;
cout<<"NPM : "<<npm[x]<<endl;
cout<<"NAMA :
"<<nama[x]<<endl;
cout<<"____________________________________________________________________________\n";
cout<<"NO. KODE NAMA SKS \n";
cout<<" MATAKULIAH MATAKULIAH \n";
cout<<"____________________________________________________________________________\n";
y=0;
while (y<2)
{
cout<<setw (3)<<(x+1)
<<setw (18)<<kode[x][y]
<<setw (18)<<matkul[x][y]
<<setw (8)<<sks[x][y]<<endl;
total_sks=total_sks+sks[x][y];
y=y+1;
}
cout<<"______________________________________\n";
cout<<"TOTAL SKS : "<<total_sks<<endl;
getch();
x=x+1;
}
}
OUTPUT
No comments:
Post a Comment