Hat jemand eine gute Erklärunf für den Datentyp complex in c++ Oder kann mir jemand so weiterhelfen Ich soll ein Programm schreiben das complexe Zahlen tauscht, int und double Zahlen funktionieren schon
#include <iostream.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <fstream>
#include <complex>
using namespace std;
std::complex;
void tausch(int& a, int& b)
{
cout << endl << "int-Funktion" << endl;
int h=a;
a=b;
b=h;
}
void tausch(double& c, double& d)
{
cout << endl << "double-Funktion" << endl;
double h=c;
c=d;
d=h;
}
void main()
{
int a=2, b=4;
double c=12.3, d=23.4;
tausch(a,b);
cout << endl << a << endl << b << endl << endl;
tausch(c,d);
cout << endl << c << endl << d << endl << endl;
}
#include <iostream.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <fstream>
#include <complex>
using namespace std;
std::complex;
void tausch(int& a, int& b)
{
cout << endl << "int-Funktion" << endl;
int h=a;
a=b;
b=h;
}
void tausch(double& c, double& d)
{
cout << endl << "double-Funktion" << endl;
double h=c;
c=d;
d=h;
}
void main()
{
int a=2, b=4;
double c=12.3, d=23.4;
tausch(a,b);
cout << endl << a << endl << b << endl << endl;
tausch(c,d);
cout << endl << c << endl << d << endl << endl;
}