Tugas ke-X input nilai mahasiswa ke dalam kolom/tabel
#include <iostream.h>
#include <conio.h>
void judul();
void isi();
int i;
int jml;
int rata;
void main(){
judul();
isi();
getch();
}
void judul(){
int i;
gotoxy(7,4);
cout<<"===================================================================";
gotoxy(7,5);
cout<<"| nim | nama | nilai |rata2 | huruf |";
gotoxy(7,6);
cout<<"| | |_____________| | | ";
gotoxy(7,7);
cout<<"| | | 1 | 2 | 3 | | |";
gotoxy(7,8);
cout<<"-------------------------------------------------------------------";
for(i=9;i<=30;i++){
gotoxy(7,i);
cout<<"| | | | | | | |";
}
gotoxy(7,30);
cout<<"===================================================================";
}
void isi(){
struct mahasiswa
{
int nim;
char nama[20];
int nilai1;
int nilai2;
int nilai3;} ;
mahasiswa mhs[25];
gotoxy(7,31);
cout<<"berapa jumlah mahasiswa:";
cin>>jml;
gotoxy(9,9);
for(i=0;i<jml;i++)
{
gotoxy(9,9+i);
cin>>mhs[i].nim;
gotoxy(21,9+i);
cin>>mhs[i].nama;
gotoxy(44,9+i);
cin>>mhs[i].nilai1;
gotoxy(49,9+i);
cin>>mhs[i].nilai2;
gotoxy(54,9+i);
cin>>mhs[i].nilai3;
rata=(mhs[i].nilai1+mhs[i].nilai2+mhs[i].nilai3)/3;
gotoxy(58,9+i);
cout<<""<<rata;
gotoxy(70,9+i);
if(rata>=85)
cout<<"A"<<endl;
else if(rata>=75)
cout<<"B"<<endl;
else if(rata>=65)
cout<<"C"<<endl;
else if(rata<65)
cout<<"D"<<endl;
}
}
semester genap