ertemuan

Jumat, 15 April 2016

Minggu 3

Nama anggota :  Edi siswanto (1500018018)
                           Galih tsabit Ulumudin (1500018019)
                           Lalu Sabrian Genata (1500018048)


Bahan diskusi kelompok minggu ke 3



#include <iostream>
#include <math.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

void cek(int a,int b){

    string huruf;
    if(a==1){
    if(b==1){

    huruf="SATU";}
   
    else{
    huruf="SE";}
    }else if(a==2){
    huruf="DUA";}   
    else if(a==3){
    huruf="TIGA";}
    else if(a==4){
    huruf="EMPAT";}   
    else if(a==5){
    huruf="lIMA";}
    else if(a==6){
    huruf="ENAM";}   
    else if(a==7){
    huruf="TUJUH";}   
    else if(a==8){
    huruf="DELAPAN";}   
    else if(a==9){
    huruf="SEMBILAN";}   
    else if(a==0){
    huruf="";
    }

cout<<huruf;

}

int main(int argc, char** argv) {
   

    int rb;
    int st;
    int angka;
    int rt;
    int pl;
    int z;
    int y;
    int u;
cout<<" masukkan 4 digit angka=";

cin>>angka;
rb=angka/1000;
u=angka %1000;
rt=u/100;
y=angka %100;
pl=y/10;
z=angka % 10;
st=z/1;
if(rb==0&&rt==0&&pl==0){
    cek(st,1)
;}

else if(rb==0&&rt==0){
    if(pl==1&&st>0){
        cek(st,0);
        cout<<" belas ";}
        else{
            cek(pl,0);
            cout<<" Puluh ";
            cek(st,1);
        }
       
   
    }
   
else if(rb==0){
    cek(rt,0);
    cout<<" RATUS ";
    if(pl==1&&st>0){
        cek(st,0);
        cout<<" belas ";}
        else if(pl==0){
        cek(st,1);
        }
        else{
            cek(pl,0);
            cout<<" PULUH ";
            cek(st,1);}
}
else{
    cek(rb,0);
    cout<<"RIBU ";
    if(rt==0){
        cout<<"";}
        else{
            cek(rt,0);
    cout<<"RATUS ";
        }
    if(pl==1&&st>0){
        cek(st,0);
        cout<<"BELAS ";}   
       
        else if(pl==0){
        cek(st,1);
        }
        else{
            cek(pl,0);
            cout<<"PULUH ";
            cek(st,1);}
   
}
   

    return 0;

}

kunjungi juga blog teman saya  Wasys  dan Galih

Tidak ada komentar:

Posting Komentar