有多个.h引用时,不能有using namespace std

时间:2024-12-10 16:35:50

#include<iostream.h> #include<math.h>

//using namespace std; 有多个.h引用时,不能有这个,否则无法运行。

void main() {    double x,y,x1,y1,x2,y2,aa;    char a;    cout<<"计算中点坐标"<<endl;    cin>>x1>>y1;    cin>>x2>>y2;    x=(x1+y1)/2;y=(x2+y2)/2;    cout<<"("<<x<<","<<y<<")"<<endl;    cout<<"计算ascii"<<endl;    cin>>a;    cout<<(int)a<<endl;    cout<<"计算平方根"<<endl;    cin>>aa;    cout<<sqrt(aa)<<endl; }