#include "CalculatorHead.h"
#include <iostream.h>
#include <string.h>
#include <math.h>
int flag0=0;
//////////////////////////////////////////////////////////////////////select_menu类
void select_menu::logic1()
{
cout<<"请自由输入两数据<以空格隔开>:"<<endl;
cout<<"<整数、分数、小数>"<<endl;
cout<<"1.两个整数"<<endl;
cout<<"2.两个分数"<<endl;
cout<<"3.分数整数"<<endl;
cout<<"4.整数分数"<<endl;
cout<<"5.返回上级"<<endl;
int ch3;
int flag=1;
while(flag)
{
cin>>ch3;
switch (ch3)
{
case 1:c3=1;flag=0;break;//两个整数
case 2:c3=2;flag=0;break;//两个分数
case 3:c3=3;flag=0;break;//互异(整分)
case 4:c3=4;flag=0;break;//互异(分整)
case 5:fundement();flag=0;break;//返回上级
default:warning();flag=1;break;
}
}
}
void select_menu::logic2()
{
cout<<"请选择要输入的数据形式:"<<endl;
cout<<"1.两个整数"<<endl;
cout<<"2.两个分数"<<endl;
cout<<"3.分数整数"<<endl;
cout<<"4.整数分数"<<endl;
cout<<"5.返回上级"<<endl;
int ch3;
int flag=1;
while(flag)
{
cin>>ch3;
switch (ch3)
{
case 1:c3=1;flag=0;break;//两个整数
case 2:c3=2;flag=0;break;//两个分数
case 3:c3=3;flag=0;break;//互异(整分)
case 4:c3=4;flag=0;break;//互异(分整)
case 5:fundement();flag=0;break;//返回上级
default:warning();flag=1;break;
}
}
}
void select_menu::logic3()
{
cout<<"请选择要输入的数据形式:"<<endl;
cout<<"1.两个整数"<<endl;
cout<<"2.两个分数"<<endl;
cout<<"3.分数整数"<<endl;
cout<<"4.整数分数"<<endl;
cout<<"5.返回上级"<<endl;
int ch3;
int flag=1;
while(flag)
{
cin>>ch3;
switch (ch3)
{
case 1:c3=1;flag=0;break;//两个整数
case 2:c3=2;flag=0;break;//两个分数
case 3:c3=3;flag=0;break;//互异(整分)
case 4:c3=4;flag=0;break;//互异(分整)
case 5:fundement();flag=0;break;//返回上级
default:warning();flag=1;break;
}
}
}
void select_menu::logic4()
{
cout<<"请选择要输入的数据形式:"<<endl;
cout<<"1.两个整数"<<endl;
cout<<"2.两个分数"<<endl;
cout<<"3.分数整数"<<endl;
cout<<"4.整数分数"<<endl;
cout<<"5.返回上级"<<endl;
int ch3;
int flag=1;
while(flag)
{
cin>>ch3;
switch (ch3)
{
case 1:c3=1;flag=0;break;//两个整数
case 2:c3=2;flag=0;break;//两个分数
case 3:c3=3;flag=0;break;//互异(整分)
case 4:c3=4;flag=0;break;//互异(分整)
case 5:fundement();flag=0;break;//返回上级
default:warning();flag=1;break;
}
}
}
void select_menu::logic5()
{
cout<<"请选择要输入的数据形式:"<<endl;
cout<<"1.两个整数"<<endl;
cout<<"2.两个分数"<<endl;
cout<<"3.分数整数"<<endl;
cout<<"4.整数分数"<<endl;
cout<<"5.返回上级"<<endl;
int ch3;
int flag=1;
while(flag)
{
cin>>ch3;
switch (ch3)
{
case 1:c3=1;flag=0;break;//两个整数
case 2:c3=2;flag=0;break;//两个分数
case 3:c3=3;flag=0;break;//互异(整分)
case 4:c3=4;flag=0;break;//互异(分整)
case 5:fundement();flag=0;break;//返回上级
default:warning();flag=1;break;
}
}
}
void select_menu::logic6()
{
cout<<"请选择要输入的数据形式:"<<endl;
cout<<"1.两个整数"<<endl;
cout<<"2.两个分数"<<endl;
cout<<"3.分数整数"<<endl;
cout<<"4.整数分数"<<endl;
cout<<"5.返回上级"<<endl;
int ch3;
int flag=1;
while(flag)
{
cin>>ch3;
switch (ch3)
{
case 1:c3=1;flag=0;break;//两个整数
case 2:c3=2;flag=0;break;//两个分数
case 3:c3=3;flag=0;break;//互异(整分)
case 4:c3=4;flag=0;break;//互异(分整)
case 5:fundement();flag=0;break;//返回上级
default:warning();flag=1;break;
}
}
}
///////////////////////////////////////////////////////////////////////////////////
void select_menu::add()
{
cout<<"请选择要输入的数据形式:"<<endl;
cout<<"1.两个整数"<<endl;
cout<<"2.两个分数"<<endl;
cout<<"3.分数整数"<<endl;
cout<<"4.整数分数"<<endl;
cout<<"5.返回上级"<<endl;
int ch3;
int flag=1;
while(flag)
{
cin>>ch3;
switch (ch3)
{
case 1:c3=1;flag=0;break;//两个整数
case 2:c3=2;flag=0;break;//两个分数
case 3:c3=3;flag=0;break;//互异(整分)
case 4:c3=4;flag=0;break;//互异(分整)
case 5:fundement();flag=0;break;//返回上级
default:warning();flag=1;break;
}
}
}
void select_menu::sub()
{
cout<<"请选择要输入的数据形式:"<<endl;
cout<<"1.两个整数"<<endl;
cout<<"2.两个分数"<<endl;
cout<<"3.分数整数"<<endl;
cout<<"4.整数分数"<<endl;
cout<<"5.返回上级"<<endl;
int ch3;
int flag=1;
while(flag)
{
cin>>ch3;
switch (ch3)
{
case 1:c3=1;flag=0;break;//两个整数
case 2:c3=2;flag=0;break;//两个分数
case 3:c3=3;flag=0;break;//互异(整分)
case 4:c3=4;flag=0;break;//互异(分整)
case 5:fundement();flag=0;break;//返回上级
default:warning();flag=1;break;
}
}
}
void select_menu::mul()
{
cout<<"请选择要输入的数据形式:"<<endl;
cout<<"1.两个整数"<<endl;
cout<<"2.两个分数"<<endl;
cout<<"3.分数整数"<<endl;
cout<<"4.整数分数"<<endl;
cout<<"5.返回上级"<<endl;
int ch3;
int flag=1;
while(flag)
{
cin>>ch3;
switch (ch3)
{
case 1:c3=1;flag=0;break;//两个整数
case 2:c3=2;flag=0;break;//两个分数
case 3:c3=3;flag=0;break;//互异(整分)
case 4:c3=4;flag=0;break;//互异(分整)
case 5:fundement();flag=0;break;//返回上级
default:warning();flag=1;break;
}
}
}
void select_menu::div()
{
cout<<"请选择要输入的数据形式:"<<endl;
cout<<"1.两个整数"<<endl;
cout<<"2.两个分数"<<endl;
cout<<"3.分数整数"<<endl;
cout<<"4.整数分数"<<endl;
cout<<"5.返回上级"<<endl;
int ch3;
int flag=1;
while(flag)
{
cin>>ch3;
switch (ch3)
{
case 1:c3=1;flag=0;break;//两个整数
case 2:c3=2;flag=0;break;//两个分数
case 3:c3=3;flag=0;break;//互异(整分)
case 4:c3=4;flag=0;break;//互异(分整)
case 5:fundement();flag=0;break;//返回上级
default:warning();flag=1;break;
}
}
}
void select_menu::pow()
{
cout<<"请选择要输入的数据形式:"<<endl;
cout<<"1.两个整数"<<endl;
cout<<"2.分数整数"<<endl;
cout<<"3.返回上级"<<endl;
int ch3;
int flag=1;
while(flag)
{
cin>>ch3;
switch (ch3)
{
case 1:c3=1;flag=0;break;//两个整数
case 2:c3=3;flag=0;break;//互异(分整)
case 3:fundement();flag=0;break;//返回上级
default:warning();flag=1;break;
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////
void select_menu::bye()
{
cout<<"goodbye!!"<<endl;
}
void select_menu::disresult()
{
cout<<"您的选择是:"<<c1<<c2<<c3<<endl;
}
void select_menu::outtype()
{
// cout<<"请选择数据输出形式:"<<endl;
// cout<<"1.小数"<<endl;
// cout<<"2.整数"<<endl;
// cout<<"3.分数"<<endl;
// cout<<"4.带分数"<<endl;
// cout<<"5.退出"<<endl;
menu4();
int ch4;
int flag=1;
while (flag)
{
cin>>ch4;
switch (ch4)
{
case 1:c4=1;flag=0;break;
case 2:c4=2;flag=0;break;
case 3:c4=3;flag=0;break;
case 4:c4=4;flag=0;break;
case 5:exit(0);break;
default:flag=1;warning();break;
}
}
}
void select_menu::warning()
{
cout<<"您的输入有误,请重新输入!\n";
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void select_menu::power()
{
cout<<"请选择要输入的数据形式:"<<endl;
cout<<"1.整数的整数"<<endl;
cout<<"2.分数的整数次方"<<endl;
cout<<"返回上级"<<endl;
c2=0;
int ch3;
int flag=1;
while (flag)
{ //二级菜单
cin>>ch3;
switch (ch3)
{
case 1:c3=1;flag=0;break;
case 2:c3=3;flag=0;break;
case 3:handle_menu();flag=0;break;
default:flag=1;warning();
}
}
}
void select_menu::logic()
{
menu3();
int ch2;
int flag=1;
while(flag)
{ //二级菜单
cin>>ch2;
switch (ch2)
{
case 1:logic1();c2=1;flag=0;break;//////////////////////////////////////////////////
case 2:logic2();c2=2;flag=0;break;//
case 3:logic3();c2=3;flag=0;break;//
case 4:logic4();c2=4;flag=0;