// operasi 1 operator.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream.h>
int main(int argc, char* argv[])
{
cout << "===========OPERASI BILANGAN===========" << "\n\n" ;
int bil1, bil2, hasil ;
char op;
cout << "\n" ;
cout << " Masukan bilangan pertama : " ;
cin >> bil1 ;
cout << "\n" ;
cout << " Masukan bilangan kedua : " ;
cin >> bil2 ;
cout << "\n" ;
cout << " Masukan operator ( + , - , / , * , %) : " ;
cin >> op ;
if (op=='+')
{
cout << "\n\n" ;
hasil = bil1 + bil2 ;
cout << "Proses " << bil1 << "+" << bil2 << "\n\n";
}
else if (op=='-')
{
cout << "\n\n" ;
hasil = bil1 - bil2 ;
cout << "Proses " << bil1 << "-" << bil2 << "\n\n";
}
else if (op=='/')
{
cout << "\n\n" ;
hasil = bil1 / bil2 ;
cout << "Proses " << bil1 << "/" << bil2 << "\n\n";
}
else if (op=='*')
{
cout << "\n\n" ;
hasil = bil1 * bil2 ;
cout << "Proses " << bil1 << "*" << bil2 << "\n\n";
}
else if (op=='%')
{
cout << "\n\n" ;
hasil = bil1 % bil2 ;
cout << "Proses " << bil1 << "%" << bil2 << "\n\n";
}
cout << "\n\n" ;
cout << "Hasilnya adalah " << hasil << "\n\n" ;
return 0;
}
Rabu, 17 Oktober 2012
APLIKASI SEDERHANA MEMBUAT OPERASI MATEMATIKA DENGAN M.VISUAL C++ 6.0
TAMPILAN APLIKASI
0 komentar:
Posting Komentar