DEV C++ Mencocokkan Jawaban

#include <iostream.h>
#include <conio.h>
#include <stdio.h>

char kunci[11],jawaban[6][11];
int  tot[6],i,j;
main()
{
j=1;
while(j<=10)
{
cout<<“Kunci soal no “<<j<<” =”;
cin>>kunci[j];
j=j+1;
}
cout<<“\n”;
i=1;
while(i<=5)
{
cout<<“Mahasiswa ke “<<i<<“\n”;
j=1;
while(j<=10)
{
cout<<“Jawaban soal no “<<j<<” = “;
cin>>jawaban[i][j];
j=j+1;
}
i=i+1;
cout<<“\n”;
}
i=1;
while(i<=5)
{
tot[i]=0;
j=1;
while(j<=10)
{
if(jawaban[i][j]==kunci[j])
{
tot[i]=tot[i]+10;
}
j=j+1;
}
i=i+1;
}                             
i=1;
while(i<=5)
{
cout<<“Mahasiswa ke “<<i<<“\n”;
cout<<“Nilai =”<<tot[i]<<“\n”;
i=i+1;
}
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: