Assalamualaikum, selamat malam teman-teman semua.. pada postingan kali ini saya membuat contoh program tabel nilai mahasiswa dengan menggunakan dev c++.. inputannya nim dan nilai..
langsung saja kita lihat contoh programnya :
Hasil program setelah di compile :
Script program :
#include <iostream>
#include <windows.h>
#include <conio.h>
#include <dos.h>
#include <stdio.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
#using namespace std;
struct nilai{
int nim,;
int nilai,;
};
nilai masuk (void)
{ nilai n;
cout<<"Masukkan Nim : ";cin>>n.nim;cout<<endl;
cout<<"Masukkan Nilai : ";cin>>n.nilai;cout<<endl;
return n;
}
void tampilan (nilai nil)
{ cout<<"NIM : "<<nil.nim<<endl;
cout<<"Nilai : "<<nil.nilai<<endl;
}
int main(int argc, char *argv[])
{
system("COLOR 4A");
cout<<"\t\t\tPenggunaan Struktur \n";
cout<<endl<<endl;
int n, total, rata2, min, max;
char nim[5];
total = 0;
cout<<"\t\t======================================== \n";
cout<<"\t\tNo\t\tNim\t\tNilai\n";
cout<<"\t\t======================================== \n";
for(int i=1; i<6; i++)
{
cout<<"\t\t";
cout<<i<<"\t\t";cin>>nim;"\t\t";cin>>n;
}
cout<<"\t\t======================================== \n";
rata2 = total/5;
cout<<"\t\tMin = "<<min<<endl;
cout<<"\t\tMax = "<<max<<endl;
cout<<"\t\tTotal = "<<total<<endl;
cout<<"\t\tRata2 = "<<rata2<<endl;
}}}
#include <windows.h>
#include <conio.h>
#include <dos.h>
#include <stdio.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
#using namespace std;
struct nilai{
int nim,;
int nilai,;
};
nilai masuk (void)
{ nilai n;
cout<<"Masukkan Nim : ";cin>>n.nim;cout<<endl;
cout<<"Masukkan Nilai : ";cin>>n.nilai;cout<<endl;
return n;
}
void tampilan (nilai nil)
{ cout<<"NIM : "<<nil.nim<<endl;
cout<<"Nilai : "<<nil.nilai<<endl;
}
int main(int argc, char *argv[])
{
system("COLOR 4A");
cout<<"\t\t\tPenggunaan Struktur \n";
cout<<endl<<endl;
int n, total, rata2, min, max;
char nim[5];
total = 0;
cout<<"\t\t======================================== \n";
cout<<"\t\tNo\t\tNim\t\tNilai\n";
cout<<"\t\t======================================== \n";
for(int i=1; i<6; i++)
{
cout<<"\t\t";
cout<<i<<"\t\t";cin>>nim;"\t\t";cin>>n;
}
cout<<"\t\t======================================== \n";
rata2 = total/5;
cout<<"\t\tMin = "<<min<<endl;
cout<<"\t\tMax = "<<max<<endl;
cout<<"\t\tTotal = "<<total<<endl;
cout<<"\t\tRata2 = "<<rata2<<endl;
}}}
0 Response to "Tabel Nilai (struct) || Dev c++"
Post a Comment