Get paid to share your links!

Operasi Bilangan Kompleks

Friday, February 8, 2013




#include <iostream.h>
#include <conio.h>

struct
{
float real1;
float real2;
float imajiner1;
float imajiner2;
}bilangan;

struct
{
   float sum_real;
float sum_ima;
float min_real;
float min_ima;
   float a,b,x,y,c,d,e,f,g,h,i;
}operasi;

main ()
{
cout<<"================================="<<endl;
cout<<"=== OPERASI BILANGAN KOMPLEKS ==="<<endl;
cout<<"================================="<<endl;
   cout<<"\nmasukkan bilangan pertama ! \n";
   cout<<"---------------------------\n";
cout<<"bilangan real 1     = "; cin>>bilangan.real1;
cout<<"bilangan imajiner 1 = "; cin>>bilangan.imajiner1;
cout<<"Bilangan yang Anda Masukkan adalah : ";
cout<<bilangan.real1<<" + "<<bilangan.imajiner1<<"i";
cout<<endl<<endl;
   cout<<"masukkan bilangan kedua ! \n";
   cout<<"---------------------------\n";
cout<<"bilangan real 2     = "; cin>>bilangan.real2;
cout<<"bilangan imajiner 2 = "; cin>>bilangan.imajiner2;
cout<<"Bilangan yang Anda Masukkan adalah : ";
cout<<bilangan.real2<<" + "<<bilangan.imajiner2<<"i"<<endl;
cout<<endl<<endl;

   operasi.sum_real = bilangan.real1 + bilangan.real2;
   operasi.sum_ima = bilangan.imajiner1 + bilangan.imajiner2;
   operasi.min_real = bilangan.real1 - bilangan.real2;
   operasi.min_ima = bilangan.imajiner1 - bilangan.imajiner2;
   operasi.a = bilangan.real1*bilangan.real2;
   operasi.b = bilangan.imajiner1*bilangan.imajiner2;
   operasi.x = bilangan.real1*bilangan.imajiner2;
   operasi.y = bilangan.real2*bilangan.imajiner1;
   operasi.c = operasi.a-operasi.b ;
   operasi.d = operasi.x+operasi.y ;
   operasi.e = operasi.a+operasi.b ;
   operasi.f = operasi.y-operasi.x ;
   operasi.g = (bilangan.real1*bilangan.real1)+(bilangan.imajiner1*bilangan.imajiner1);
   operasi.h = (bilangan.real2*bilangan.real2)+(bilangan.imajiner2*bilangan.imajiner2);
   operasi.i = (operasi.g/operasi.e)+(operasi.f/operasi.h);

cout<<"penjumlahan"<<endl;

cout<<"("<<bilangan.real1<<"+"<<bilangan.imajiner1<<"i) "
    <<" + "<<"("<<bilangan.real2<<"+"<<bilangan.imajiner2<<"i) = "
    <<operasi.sum_real<<"+"<<operasi.sum_ima<<"i"<<endl;
cout<<endl<<endl;

cout<<"pengurangan"<<endl;
cout<<"("<<bilangan.real1<<"+"<<bilangan.imajiner1<<"i) "
    <<" - "<<"("<<bilangan.real2<<"+"<<bilangan.imajiner2<<"i) = "
    <<operasi.min_real<<"+"<<operasi.min_ima<<"i"<<endl;
cout<<endl<<endl;

cout<<"perkalian"<<endl;
cout<<"("<<bilangan.real1<<"+"<<bilangan.imajiner1<<"i) "
    <<" * "<<"("<<bilangan.real2<<"+"<<bilangan.imajiner2<<"i) = "
    <<operasi.a<<"+"<<operasi.x<<"i"<<" + "
<<operasi.y<<"i"<<" - "<<operasi.b
<<" = "<< operasi.c <<" + "
<< operasi.d<<"i"<<
endl;

cout<<"pembagian"<<endl;
cout<<"("<<bilangan.real1<<"+"<<bilangan.imajiner1<<"i) "
    <<" * "<<"("<<bilangan.real2<<"+"<<bilangan.imajiner2<<"i) = ("
    <<operasi.g<<" / "<<operasi.e<<") + ("
<<operasi.f<<"i"<<") / "<<operasi.h
<<" = "<< operasi.i <<
endl;

   getch();
}
Share this article :

0 comments:

Speak up your mind

Tell us what you're thinking... !

others

Loading...

Followers

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Blog - All Rights Reserved
Template Created by Creating Website Inspired by Sportapolis Shape5.com
Proudly powered by Blogger