Assalamualaikum.
hello everyone, now my post will using english. coz i wanna learn english :D
haha
now, i want to post something......... i thing not something. just a simple program. :D
yups, desimal to oktal.
this is not tutorial. but source or script kid.
i make it just now. i make it cause i got a lesson in my class this morning about this.
ok, before go to the source; we will learn how to count it.
ex : desimal = 316
we want to convert it to oktal.
ok.
316 : 8 = 39 ==>the remaining = 4
39 : 8 = 4 ==> the remaining = 7
so, the oktal will be 474.
ok, i thing u know it.
now, go to the source :
compiler : Devc++
hello everyone, now my post will using english. coz i wanna learn english :D
haha
now, i want to post something......... i thing not something. just a simple program. :D
yups, desimal to oktal.
this is not tutorial. but source or script kid.
i make it just now. i make it cause i got a lesson in my class this morning about this.
ok, before go to the source; we will learn how to count it.
ex : desimal = 316
we want to convert it to oktal.
ok.
316 : 8 = 39 ==>the remaining = 4
39 : 8 = 4 ==> the remaining = 7
so, the oktal will be 474.
ok, i thing u know it.
now, go to the source :
#include <iostream>
using namespace std;
main()
{
int oktal, oktalsisa1, oktalsisa2, oktal2, oktalsisa3, oktal3,oktalsisa4, oktal4, oktal5, oktalsisa5,oktal6,oktal7,oktalsisa6,oktalsisa7;
int des;
int pilih;
cout<<" Name : Bayu Fajar Pratama \
\n Sumbawa Besar.\n\n";
cout<<"1. Desimal to oktal pilih : ";
cin>>pilih;
if(pilih==1)
{
cout<<"masukkan bilangan desimal : ";
cin>>des;
for(int i = des ; i>7 ; i--)
{
oktalsisa1 = des % 8;
oktal = des / 8;
oktalsisa2 = oktal % 8;
oktal2 = oktal / 8;
oktalsisa3 = oktal2 % 8;
oktal3 = oktal2 / 8;
oktalsisa4 = oktal3 % 8;
oktal4 = oktal3 / 8;
oktalsisa5 = oktal4 % 8;
oktal5 = oktal4 / 8;
oktalsisa6 = oktal5 % 8;
oktal6 = oktal5 / 8;
oktalsisa7 = oktal6 % 8;
oktal7 = oktal6/8;
}
cout<<"bilangan oktalnya = "<<oktal7<<oktalsisa7<<oktalsisa6<<oktalsisa5<<oktalsisa4<<oktalsisa3<<oktalsisa2<<oktalsisa1;
}
}
compiler : Devc++
No comments:
Post a Comment