Minggu, 13 November 2011

Contoh array input nilai dengan C++

Buatlah program input pemasukan data nilai mahasiswa, yang memuat :
NIM, nama, nilai tugas, nilai UAS, nilai UTS.

2. Jawaban :

#include
#include
#include
#include
void main()
{
int i, data;
char nama[10][20],nim[10][5];
float nilaitgs[10];
float nilaiuts[10];
float nilaiuas[10];
float hasil[10];


cout<<"Data Yang Akan Diinputkan : ";cin>>data;
for(i=0;i<<" Data Ke - "<<<<" NIM Siswa : "; gets(nim[i]); cout<<" Nama Siswa : "; gets(nama[i]); cout<<" Nilai Tugas : "; cin>>nilaitgs[i];
cout<<" Nilai UTS : "; cin>>nilaiuts[i];
cout<<" Nilai UAS : "; cin>>nilaiuas[i];
hasil[i] = (nilaitgs[i] * 0.2) + (nilaiuts[i] * 0.3) + (nilaiuas[i] * 0.5);
cout<<" Nilai Akhir : "<<<<"-----------------------------------------------------------------------------"<<<"No NIM Nama Siswa Nilai Nilai Nilai Hasil Nilai"<<<" Tugas UTS UAS Ujian Huruf"<<<"-----------------------------------------------------------------------------"<<<<<<<<<<<<<" "<<<<" "<<<<" "<<<<" "<=90)
cout<<" A"<=80)
cout<<" B"<=70)
cout<<" C"<=60)
cout<<" D"<
else
cout<<" E"<
}
cout<<"----------------------------------------------------------------------------"<
getch();
}

0 komentar:

Posting Komentar

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Best Buy Coupons