Senin, 17 Maret 2014

algoritma dan pemrograman konversi nilai


Algoritma mengkonversi nilai
{nilai angka menjadi nilai huruf}

desklarasi
    nilai : integer
   
deskripsi
    read : (nilai)
     if ((nilai>=80))and then (Nilai huruf "A")
     else if(nilai>=61)and(nilai<80) then (Nilai huruf "B")
     else if(nilai>=41)and(nilai<60) then (Nilai huruf "C")
     else if(nilai>=21)and(nilai<40) then (Nilai huruf "D")
     else (Nilai huruf : E")
    write: nilai huruf
    
 
#include <cstdlib>
#include <iostream>

using namespace std;
class konversi {
      public :
             void input ();
             void proses ();
         int nilai;

      };

void konversi :: input(){

     cout<<"Masukkan nilai angka : ";
     cin>>nilai;
     cout<<endl;

     }

void konversi :: proses() {
    
     if ((nilai>=80))
     cout<<"Nilai huruf : A"<<endl;

     else if ((nilai>=61)&&(nilai<80))
     cout<<"Nilai huruf : B"<<endl;

     else if ((nilai>=41)&&(nilai<60))
     cout<<"Nilai huruf : C"<<endl;
    
     else if ((nilai>=21)&&(nilai<40))
     cout<<"Nilai huruf : D"<<endl;
    
     else
     cout<<"Nilai huruf : E"<<endl;
     }


    

int main(int argc, char *argv[])
{
    cout<<"|==============================|"<<endl;
    cout<<"|            PROGRAM           |"<<endl;
    cout<<"|         Konversi Nilai       |"<<endl;
    cout<<"|                              |"<<endl;
    cout<<"|==============================|"<<endl;
    cout<<"\n\n";
   
   
    konversi angka;
    angka.input();
    angka.proses();

    system("PAUSE");
    return EXIT_SUCCESS;
}
Share:

Tidak ada komentar:

Posting Komentar

© journey of life All rights reserved | Theme Designed by Seo Blogger Templates