Tuesday, November 27, 2012

Unknown

Program Menghitung IP (A,B,C,D,E) dengan C++


Pagi sobat Ferason..
Sekarang saya share Program Menghitung IP (A,B,C,D,E) dengan C++, langsung saja source codenya seperti berikut:

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

int fungsi_menu(void);
float fungsi_ip(float x);
int menu_exit(void);

main ()
{
  fungsi_menu();
  return 0;
}

int fungsi_menu()
{
  clrscr();
  char m[100];
  int n;
  int ip,a[6],x;


  cout<<"-------- PROGRAM MENGHITUNG IP -------"<<endl;
  cout<<"----- KELAS B11 STMIK ASIA MALANG ----"<<endl;
  cout << "\n Masukkan nama mahasiswa : ";
  gets(m);
  cout<<" Masukkan NIM : ";
  cin >>n;
  cout<<" Nilai Tugas 1 : ";
  cin>>a[0];
  x=(a[0])*0.1;
  cout<<" Nilai Tugas 2 : ";
  cin>>a[1];
  x=(a[1])*0.1;
  cout<<" Nilai Tugas 3 : ";
  cin>>a[2];
  x=(a[2])*0.1;
  cout<<" Nilai Quiz    : ";
  cin>>a[3];
  x=(a[3])*0.25;
  cout<<" Nilai UTS     : ";
  cin>>a[4];
  x=(a[4])*0.3;
  cout<<" Nilai UAS     : ";
  cin>>a[5];
  x=(a[5])*0.35;

  ip=fungsi_ip(x);
  cout<<"\n ============ ";
  cout<<"\n   Hasil IP ";
  cout<<"\n ============ ";
  cout<<"\n NAMA  = "<<m;
  cout<<"\n NIM   = "<<n;
  cout<<"\n IP    = "<<ip;
  cout<<"\n Grade = ";

   switch (ip)
  {
  case 4: cout<<'A'<<endl;break;
  case 3: cout<<'B'<<endl;break;
  case 2: cout<<'C'<<endl;break;
  case 1: cout<<'D'<<endl;break;
  case 0: cout<<'E'<<endl;break;
  default:break;
  }

  menu_exit();
  return 0;
}


float fungsi_ip(float x)
{
 float ip;
 ip=x/7;
 return ip;
}


int menu_exit()
{
  char b;
  cout << "\n Apakah ingin menghitung lagi (y/t) : ";
  cin >> b;
  if (b=='y'||b=='Y')
  {
         cout << endl;
         fungsi_menu();
  }
  else
  {
          cout << "\n Terima Kasih Telah Menggunakan Program Ini";
  }
  getch();
  return 0;
}

Unknown

About Unknown -

Author Description here.. Nulla sagittis convallis. Curabitur consequat. Quisque metus enim, venenatis fermentum, mollis in, porta et, nibh. Duis vulputate elit in elit. Mauris dictum libero id justo.

Subscribe to this Blog via Email :