Contoh Program C++ Hitung Data Nilai Siswa#include#include#include#include
int data_nilai[2][10];
void isi_data(int nilai[2][10]);void cetak_data(int nilai[2][10]);int tertinggi(int nilai[2][10],int x);int tertinggi_all(int nilai[2][10]);
void main(){cout << "===============================" << endl;cout << "Program Hitung Data Nilai Siswa" << endl;cout << "===============================" << endl;cout <<"By :Devia Christa"<
cout << endl;int nilai[2][10],x;isi_data(nilai);cetak_data(nilai);cout << "Nilai Tertinggi kelas 1 = " << tertinggi(nilai,0) << endl;cout << "Nilai Tertinggi kelas 2 = " << tertinggi(nilai,1) << endl;cout << "Nilai Tertinggi semua kelas = " << tertinggi_all(nilai) << endl;cout << endl;cout << "Tekan sembarang tombol untuk keluar";getch();}
void isi_data(int nilai [2][10]){randomize();for(int k=0;k<10 div="" k="">10>
{nilai[0][k] = random(101);nilai[1][k] = random(101);}}void cetak_data(int nilai[2][10]){for(int m=0;m<2 div="" m="">2>
{cout << "Pelajaran" << (m+1)<< ":" << endl;for(int k=0;k<10 div="" k="">10>
cout << (k+1) << ":" << nilai[m][k] << " ";cout << endl;}}
int tertinggi(int nilai[2][10],int x){int t = nilai[x][0];for (int k=1; k<10 div="" k="">10>
if (nilai[x][k] > t)t = nilai[x][k];return t;}int tertinggi_all (int nilai[2][10]){int t = nilai[0][0];for (int x=0;x<2 div="" x="">2>
{for (int k=1; k<10 div="" k="">10>
if (nilai[x][k] > t)t = nilai[x][k];}return t;}
Wednesday, April 9, 2014
Contoh Program C++ Hitung Data Nilai Siswa
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment