[求助][讨论]vc++
#include<stdlib.h>#include<iostream.h>
class calculation
{
public:
void add();
void sub();
void mul();
void div();
void setxy(double x1,double y1);
privte:
double x,y;
}
void main (int argc,char *argv[])
void (calculation::*pfun)();
cslculation call;
if (argc!=4)
{
cout<<"ERROR!!"<<endl;
cout<<usage:for example:cal 3 + 5"<<endl;
return;
}
switch (srgv[2][0])]
{case '+': pfun=calculation::add;
break;
case '-': pfun=calculation::sub;
break;
case '*': pfun=calculation::mul;
break;
case '/': pfun=calculation::dir;
break;
default: {cout<<"operator is error!";
return;
}
}
call setxy(atof(argv[1],atof(argv[3]));
call *pfun();
void calculation::add()
{cout<<"x="<<x<<"y="<<y<<"\t\tx+y="<<x+y<<endl;
}
void calculation::sub;
{cout<<"x="<<x<<"y="<<y<<"\t\tx+y="<<x+y<<endl;
}
void calculation::mul;
{cout<<"x="<<x<<"y="<<y<<"\t\tx+y="<<x+y<<endl;
}
void calculation::dir;
{cout<<"x="<<x<<"y="<<y<<"\t\tx+y="<<x+y<<endl;
}
void calculation::setxy(double x1, double y1)
{x=x1;
y=y1;
}
看看有什么问题 拜托拜托..............