CONTOH PROGRAM DATA MAHASISWA MENGGUNAKAN BAHASA C++ - Ade Wahyudin

Selasa, 26 Januari 2016

CONTOH PROGRAM DATA MAHASISWA MENGGUNAKAN BAHASA C++

#include <conio.h>
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <windows.h>
using namespace std;
void gotoxy(short x, short y){
COORD pos = {x,y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
main()
{
double aktif[50], tugas[50], ujian[50], akhir[50];
char nama[50][50];
char grade[50];
int menu, data, i=1,j=1,k=1,l=1, menudel, status[50];
while(menu!=5){
cout<<"Pilih Menu pilihan Anda : "<<endl;
cout<<"1. Insert Data : "<<endl;
cout<<"2. Output Data : "<<endl;
cout<<"3. Edit Data : "<<endl;
cout<<"4. Delete Data : "<<endl;
cout<<"5. Close : "<<endl;
cout<<"Pilihan Anda adalah : ";
cin>>menu;
cout<<endl<<"--------------------------------------------------------------------------------"<<endl;
switch(menu)
{
case 1:
system("CLS");
cout<<endl<<"Masukkan Jumlah data yang mau di input : ";
cin>>j;
if(k!=1)
{
j = (k+j)-1;
}
gotoxy(1,4);cout<<" No";
gotoxy(10,4);cout<<"| Nama";
gotoxy(40,4);cout<<"| Nilai";
gotoxy(63,4);cout<<"|";
gotoxy(10,5);cout<<"|";
gotoxy(40,5);cout<<"| Aktif";
gotoxy(48,5);cout<<"| Tugas";
gotoxy(55,5);cout<<"| Ujian |";
cout<<endl<<"--------------------------------------------------------------------------------"<<endl;
for(i=k;i<=j;i++)
{
gotoxy(5,i+6);cout<<i;
gotoxy(10,i+6);cout<<"| ";scanf(" %[^\n]s",nama[i]);
do
{
gotoxy(40,i+6);cout<<"| ";cin>>aktif[i];
}
while(aktif[i]>100);
do
{
gotoxy(48,i+6);cout<<"| ";cin>>tugas[i];
}
while(tugas[i]>100);
do
{
gotoxy(55,i+6);cout<<"| ";cin>>ujian[i];
}
while(ujian[i]>100);
gotoxy(63,i+6);cout<<"|";
cout<<endl;
aktif[i] = aktif[i] * 0.2;
tugas[i] = tugas[i] * 0.3;
ujian[i] = ujian[i] * 0.5;
akhir[i] = aktif[i]+tugas[i]+ujian[i];
status[i] = 1;
if(akhir[i]>=80)
{
grade[i] = 'A';
} else if(akhir[i]>=65 && akhir[i]<=79)
{
grade[i] = 'B';
} else if(akhir[i]>=55 && akhir[i]<=64)
{
grade[i] = 'C';
} else if(akhir[i]>=40 && akhir[i]<=54)
{
grade[i] = 'D';
} else if(akhir[i]<=40)
{
grade[i] = 'E';
}
}
k = j+1;
cout<<endl<<"--------------------------------------------------------------------------------"<<endl;
break;
case 2:
system("CLS");
cout<<endl<<"OUTPUT DATA SISWA"<<endl;
cout<<endl<<"--------------------------------------------------------------------------------"<<endl;
gotoxy(1,4);cout<<" No";
gotoxy(10,4);cout<<"| Nama";
gotoxy(40,4);cout<<"| Nilai";
gotoxy(70,4);cout<<"| Grade";
gotoxy(10,5);cout<<"|";
gotoxy(40,5);cout<<"| Aktif";
gotoxy(48,5);cout<<"| Tugas";
gotoxy(55,5);cout<<"| Ujian";
gotoxy(62,5);cout<<"| Akhir";
gotoxy(70,5);cout<<"|";
cout<<endl<<"--------------------------------------------------------------------------------"<<endl;
for(i=1;i<=j;i++)
{
if(status[i] == 2)
{
}
else
{
gotoxy(1,(i*2)+6);cout<<i;
gotoxy(10,(i*2)+6);cout<<"| "<<nama[i];
gotoxy(40,(i*2)+6);cout<<"| "<<aktif[i];
gotoxy(48,(i*2)+6);cout<<"| "<<tugas[i];
gotoxy(55,(i*2)+6);cout<<"| "<<ujian[i];
gotoxy(62,(i*2)+6);cout<<"| "<<akhir[i];
gotoxy(70,(i*2)+6);cout<<"| "<<grade[i];
cout<<endl<<"--------------------------------------------------------------------------------"<<endl;
}
}
getch();
break;
case 3:
system("CLS");
if(status[i] == 2)
{
}
else
{
gotoxy(1,4);cout<<" No";
gotoxy(10,4);cout<<"| Nama";
gotoxy(40,4);cout<<"| Nilai Akhir";
gotoxy(56,4);cout<<"| Grade |";
for(i=1;i<=j;i++)
{
gotoxy(3,(i*2)+4);cout<<i;
gotoxy(13,(i*2)+4);cout<<nama[i];
gotoxy(43,(i*2)+4);cout<<akhir[i];
gotoxy(59,(i*2)+4);cout<<grade[i];
cout<<endl<<"--------------------------------------------------------------------------------"<<endl;
}
cout<<endl<<"Pilih nomor data yang hendak di edit : ";
cin>>l;
cout<<endl<<"Nama Awal Siswa adalah : "<<nama[l]<<" Diganti Menjadi : ";
scanf(" %[^\n]s",nama[l]);
do
{
cout<<endl<<"Nilai keaktifan Awal Siswa adalah : "<<aktif[l]*5<<" Diganti Menjadi : ";
cin>>aktif[l];
}
while(aktif[l]>100);
do
{
cout<<endl<<"Nilai keaktifan Tugas Siswa adalah : "<<tugas[l]*3.33<<" Diganti Menjadi : ";
cin>>tugas[l];
}
while(tugas[l]>100);
do
{
cout<<endl<<"Nilai Ujian Awal Siswa adalah : "<<ujian[l]*2<<" Diganti Menjadi : ";
cin>>ujian[l];
}
while(ujian[l]>100);
cout<<endl;
aktif[l] = aktif[l] * 0.2;
tugas[l] = tugas[l] * 0.3;
ujian[l] = ujian[l] * 0.5;
akhir[l] = aktif[l]+tugas[l]+ujian[l];
cout<<"-------------------------------------------------------"<<endl;
getch();
}
break;
case 4:
system("CLS");
gotoxy(1,4);cout<<" No";
gotoxy(10,4);cout<<"| Nama";
gotoxy(40,4);cout<<"| Nilai Akhir";
gotoxy(56,4);cout<<"| Grade";
gotoxy(65,4);cout<<"| Status";
for(i=1;i<=j;i++)
{
gotoxy(3,(i*2)+4);cout<<i;
gotoxy(13,(i*2)+4);cout<<nama[i];
gotoxy(43,(i*2)+4);cout<<akhir[i];
gotoxy(59,(i*2)+4);cout<<grade[i];
gotoxy(68,(i*2)+4);cout<<status[i];
cout<<endl<<"--------------------------------------------------------------------------------"<<endl;
}
cout<<endl<<"Pilih nomor data yang hendak di Hapus : ";
cin>>l;
cout<<endl<<"Data Siswa : "<<nama[l]<<" akan di hapus?";
cout<<endl<<"1. Ya";
cout<<endl<<"2. tidak";
cout<<endl<<"3. Aktifkan Kembali";
cout<<endl<<"Pilihan Anda Adalah : ";
cin>>menudel;
if(menudel == 1)
{
status[l] = 2;
}
else if (menudel == 2)
{
cout<<endl<<"Data Siswa : "<<nama[l]<<" Tidak jadi di hapus?";
}
else if (menudel == 3)
{
status[l] = 1;
}
else
{
cout<<endl<<"Pilihan salah";
}
cout<<endl;
getch();
break;
case 5:
break;
default:
cout<<"Pilihan Ilegal"<<endl;
}
}
getche();
}


Cukup  sekian  penjelasan  saya  tentang  Program  Data  Mahasiswa,  Semoga  artikel  ini   bermanfaat  bagi  anda  semua.  Terima  Kasih


Silahkan  kunjungi  kami di http://qicera

Tidak ada komentar:

Posting Komentar