任务一求两个数的平方根
1-25
#include "stdafx.h"
#include <stdio.h>
#include<iostream>
using namespacestd;
class complex
{
private:
double real;
double imag;
public:
complex(double r,double i)
{
real =r;
imag =i;
}
double abcomplex()
{
double t;
t =real*real + imag*imag;
return sqrt(t);
}
};
int main()
{
double a = 0,b=0;
cout<< "请输入两个数:" << endl;
cin>> a>>b;
complex j(a,b);
cout<< "这两个数的平方根是:" << j.abcomplex() << endl;
return0;
getchar();
}