Find Here !!!

Tuesday, 22 April 2014

Program Sederhana Memasukkan Data Nilai menggunakan STRUCT

#include<stdio.h>
#include<conio.h>
#include<iostream.h>
main()
{
int i;
struct
{
char nim[5];
char nama[15];
float nilai;
} mhs[5];



clrscr();
for(i=1; i<=2; i++)
{
cout<<"masukan NIM = "; cin>>mhs[i].nim;
cout<<"masukan Nama = "; cin>>mhs[i].nama;
cout<<"masukan Nilai Akhir = "; cin>>mhs[i].nilai;
}
cout<<endl;
cout<<"data Mahasiswa"<<endl;
for(i=1; i<=2; i++)
{
cout<<endl<<"Data Ke - "<<i<<endl;
cout<<"NIM = "<<mhs[i].nim<<endl;
cout<<"Nama = "<<mhs[i].nama<<endl;
cout<<"Nilai Akhir = "<<mhs[i].nilai<<endl;
cout<<endl;
}

getch();
}

No comments:

Post a Comment