Professional Documents
Culture Documents
REGO
NPM : 17411087
SHIFT :2
CODING :
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include <windows.h>
struct Mahasiswa
int usia;
};
SetConsoleTextAttribute(hCon, color);
Mahasiswa inputData()
Mahasiswa Mhs;
setcolor(1);
cout<<"Nama = ";
gets(Mhs.nama);
cout<<"NIM = ";
gets(Mhs.nim);
cout<<"Usia = ";
cin>>Mhs.usia;
cout<<endl;
return Mhs;
cout<<"Nama ="<<Mahasiswa.nama<<endl;
cout<<"NIM ="<<Mahasiswa.nim<<endl;
cout<<"Usia ="<<Mahasiswa.usia<<endl;
void main()
system("color eE");
int n,j;
clrscr();
setcolor(4);
cin>>j;
for (n=0;n<j;n++)
setcolor(5);
cout<<"Data ke "<<n+1<<endl;
mhs[n]=inputData();
clrscr();
setcolor(9);
setcolor(3);
gotoxy (5 ,5) ;cout<<"+ -----------------------------------------------+\n";
setcolor(2);
setcolor(3);
setcolor(2);
setcolor(3);
setcolor(2);
setcolor(3);
for (n=0;n<j;n++)
gotoxy(5 ,n+8);cout<<"|";
setcolor(2);
gotoxy(10,n+8);cout<<mhs[n].nama;
setcolor(3);
gotoxy(27,n+8);cout<<"|";
setcolor(2);
gotoxy(31,n+8);cout<<mhs[n].nim;
setcolor(3);
gotoxy(42,n+8);cout<<"|";
setcolor(2);
gotoxy(48,n+8);cout<<mhs[n].usia;
setcolor(3);
gotoxy(54,n+8);cout<<"|";
gotoxy(54,n+9);cout<<"|";
gotoxy(54,n+9);cout<<"|";
gotoxy(5 ,n+9);cout<<"|";
gotoxy(27,n+9);cout<<"|";
gotoxy(42,n+9);cout<<"|";
};
gotoxy(5,n+9);cout<<"+------------------------------------------------+\n";
getch ();
}
OUTPUT :