Decimal 2 Roman Converter Dev C++

Berikut adalah kode program yang dapat memberikan keluaran Decimal 2 Roman, kode bisa digunakan pada aplikasi Dev C++ ataupun aplikasi program bahasa C lainnya. Bagi anda yang belum mempunyai Dev C++, bisa di download di Download Dev C++, lalu silakan di install.

#include <iostream>
using namespace std;

int main() {
int num;

char lagi;
do
{
double ip;
cout << "====================================" << endl;
cout << "=====Decimal 2 Roman Converter======" << endl;
cout << "====================================" << endl;
string s="";
cin>>num;
cout<<"Number in Decimal:"<<num<<"\n";
string roman[] = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};
int decimal[] = {1000,900,500,400,100,90,50,40,10,9,5,4,1};
for (int i = 0; i < 13; i++)
{

while (num >= decimal[i])
{
num = num-decimal[i];
s = s+roman[i];
}
}

cout<<"Number in Roman Numerals:"<<s;

cout<<"\n\nReply [Y/T] : ";cin>>lagi;
}
while(lagi == 'y' || lagi == 'Y');

cout <<"|==========================|"<<endl;
cout <<"| TEKAN ENTER UNTUK KELUAR!|"<<endl;
cout <<"| creative:Faisal Haibib   |"<<endl;
cout <<"|==========================|";
return 0;
}

Dengan Hasil running :

Rich Snippets
Published
Article
Decimal 2 Roman Converter
Ratings
51star1star1star1star1star

Kata Bijak? Google banyak!

You may also like...

Leave a Reply