Jump to content

Recommended Posts

Posted

#include<math.h>

class complex

{

public:

	float x, y;

	float modul();

};

float complex::modul()

{

	return sqrt(x*x+y*y);

}
#include<iostream>

#include "complex.cpp"

using namespace std;

int main()

{

	complex v[100];

	float max;

	int n, i;

	cout<<"dati nr de elemente al vectorului: ";

	cin>>n;

	for(i=0; i<n; i++)

	{

		cout<<"numarul complex:"<<i+1;

		cout<<"dati partea reala: ";

		cin>>v[i].x;

		cout<<"dati partea imaginara: ";

		cin>>v[i].y;

	}

max=v[0].modul();

for(i=1; i<n; i++)

if(v[i].modul()>max)

max=v[i].modul();

cout<<"max este egal cu: "<<max;

system("PAUSE");

return 0;

}

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.