wtorek, 4 listopada 2014

//ZESPOLONE DEFINICJE

#include <iostream>
#include"funkcjezespolone.cpp"
#include"zespolona.h"
#include <stdarg.h>

using namespace std;



 const Zespolona operator + ( Zespolona&w, Zespolona& z)
 {
     return Zespolona(z.Re() + w.Re() ,z.Im() + w.Im());
 }


ostream& operator << (ostream& wy,Zespolona &z)
{
    wy<< z.Re()<<"+"<< z.Im()<<"i"<<endl;
    return wy;
}

istream& operator>> (istream& we, Zespolona& z)
{
   we>>z.a;
   we>>z.b;
   return we;
}





    float max ( float A[3])
{
    int b=0;
    float a=A[0];
    for(int i=1; i<3; i++)
    {
      if(A[i]>a) {a=A[i]; b=i;}
    }

    return b;
}

void wpisywanie (Zespolona& z1, Zespolona & z2, Zespolona& z3 )
{


float B[3];
B[0]=z1.Re();
B[1]=z2.Re();
B[2]=z3.Re();


float C[3];
C[0]=z1.Im();
C[1]=z2.Im();
C[2]=z3.Im();

int x= max(C);
if(max(C)== max(B))
    cout<<"Max =" <<B[x]<<"+"<<C[x]<<"i"<<endl;

else cout<<"Niestety, nie ma najwiekszego"<<endl;

}



Brak komentarzy:

Prześlij komentarz