Listing Program C++ Structure Sederhana

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

main()
{
struct
{
char nim[5];
char nama[15];
float nilai;
} mahasiswa;

clrscr();
cout<<"masukan NIM = ";
cin>>mahasiswa.nim;
cout<<"masukan Nama = ";
cin>>mahasiswa.nama;
cout<<"masukan Nilai Akhir = ";
cin>>mahasiswa.nilai;

clrscr();

cout<<"NIM = "<<mahasiswa.nim<<endl;
cout<<"Nama = "<<mahasiswa.nama<<endl;
cout<<"Nilai Akhir = "<<mahasiswa.nilai<<endl;

getch();
}
Previous
Next Post »