#include<stdio.h>
#include<conio.h>
struct mahasiswa
{
char Nim[10];
char Nama[20];
char Kelas[2];
};
/*void tukar(char *a,char *b)
{
char c;
c=*a;
*a=*b;
*b=c;
}*/
void main()
{
mahasiswa mhs[10];
int i,data;
printf("Masukkan banyak data(Max 10): "); scanf("%d",&data);
for (i=0;i<data;i++)
{
printf("\nData Mahasiswa ke-%d\n",i+1);
printf("NIM: "); scanf("%s",&mhs[i].Nim);
printf("Nama: "); scanf("%s",&mhs[i].Nama);
printf("Kelas: "); scanf("%s",&mhs[i].Kelas);
clrscr();
}
clrscr();
puts("\n DATA MAHASISWA INFORMATIKA");
puts("_______________________________________________");
puts("No.|NIM |Nama |Kelas");
puts("_______________________________________________");
/*for (i=1;i<data;i++)
{
for (j=i;j<data;j++)
{
if (mhs[i].Nim>mhs[j].Nim)
{
tukar(&mhs[i].Nim,&mhs[j].Nim);
//tukar(&mhs[i].Nama,&mhs[j].Nama);
//tukar(&mhs[i].Kelas,&mhs[j].Kelas);
}
}
}*/
for (i=0;i<data;i++)
{
printf("%d | %s |%s |%s\n",i+1,mhs[i].Nim,mhs[i].Nama,mhs[i].Kelas);
puts("_____________________________________________________\n");
}
getch();
}
TAMPILAN PROGRAM NYA
Tidak ada komentar:
Posting Komentar