TUGAS 7
TUGAS 7
Data ke-1
NIM :
NAMA :
KELAS :
NILAI 1 :
NILAI 2 :
NA :
Data ke-2
NIM :
NAMA :
KELAS :
NILAI 1 :
NILAI 2 :
NA :
DATA NILAI MAHASISWA BSI
===============================================================
No. NIM NAMA KELAS NILAI 1 NILAI 2 NA KET
1.
2.
===============================================================
Listing Programnya :
#include <conio.h>
#include <iostream.h>
#include <iomanip.h>
#include <stdio.h>
main()
{
char nama[20][10],nim[8][10],kelas[10][10],*ket[10];
int i,q,n1[10],n2[10],na[10];
cout<<" DATA NILAI MAHASISWA BSI "<<endl;
cout<<" =========================== "<<endl;
cout<<" masukkan jumlah mahasiswa = ";cin>>q;
for (i=1;i<=q;i++)
{
cout<<" DATA KE - "<<i<<endl;
cout<<" NIM :";cin>>nim[i];
cout<<" NAMA :";cin>>nama[i];
cout<<" KELAS :";cin>>kelas[i];
cout<<" NILAI 1 :";cin>>n1[i];
cout<<" NILAI 2 :";cin>>n2[i];
cout<<endl;
na[i]=(n1[i]+n2[i])/2;
if (na[i]>=65)
{
ket[i]= "lulus";
}
else
{
ket[i]= "tidak lulus";
}
}
clrscr();
cout<<" DATA NILAI MAHASISWA "<<endl;
cout<<"==========================================================================="<<endl;
cout<<"NO. NAMA NIM KELAS NILAI1 NILAI2 NA KET "<<endl;
cout<<"==========================================================================="<<endl;
for (i=1;i<=q;i++)
{
cout<<setiosflags (ios::left)<<setw(10)<<i;
cout<<setiosflags (ios::left)<<setw(10)<<nama[i];
cout<<setiosflags (ios::left)<<setw(10)<<nim[i];
cout<<setiosflags (ios::left)<<setw(10)<<kelas[i];
cout<<setiosflags (ios::left)<<setw(10)<<n1[i];
cout<<setiosflags (ios::left)<<setw(10)<<n2[i];
cout<<setiosflags (ios::left)<<setw(10)<<na[i];
cout<<setiosflags (ios::left)<<setw(10)<<ket[i];
}
cout<<"==========================================================================="<<endl;
getch();
}
HASIL RUNNING 7.1 :
HASIL RUNNING 7.2 :
download tugas7
Tidak ada komentar:
Posting Komentar