#include<iostream>
#include<string>
#include<cmath>

using namespace std;

const string choice_str[]={
	"",
	"1 - integer calculating",
	"2 - floating-point calculating",
	"3 - power calculating",
	"4 - square root calctlating",
	"5 - cube root calculating",
	"6 - power root calculating"
};
int choice;
string ans="0";

void menu();
bool int_calc();
bool float_calc();
bool power_calc();
bool power_root(const int mode);

int main()
{
//	ios::sync_with_stdio(false);
//	cin.tie(NULL);
//	cout.tie(NULL);
	
	while(true)
	{
		menu();
		
		cin>>choice;
		cout<<'\n';
		
		if(!choice)
			return 0;
		
		while(true)
		{
			cout<<"You now choosed "<<choice_str[choice]<<'\n';
			
			if(choice==1)
				
		}
	}
}
void menu()
{
	cout
	<<"Welcome to the All-in-One Calculator!\n\n"
	<<"Please enter your choice:\n\n";
	
	for(int i=1;i<=6;++i)
		cout<<choice_str[i]<<'\n';
	
	cout<<'\n';
}

bool int_calc()
{
	string s1,s2;
	char op;
	long long a,b,c;
	
	cout<<"Input the two integers (input \"ans\" to use the result of the previous calculation), or input \"quit\" to return to main menu:\n";
	cin>>s1;
	
	if(s1=="quit")
		return false;
	
	cin>>s2;
	
	if(s2=="quit")
		return false;
	
	a=stoll(s1=="ans"?ans:s1);
	b=stoll(s2=="ans"?ans:s2);
	
	cout<<"Input the operator(+(add),-(sub),*(multiply),/(divide),%(mod)):";
	cin>>op;
	
	switch(op)
	{
		case '+':
			c=a+b;
			break;
		case '-':
			c=a-b;
			break;
		case '*':
			c=a*b;
			break;
		case '/':
			cout<<a<<" / "<<b<<" = "<<(double)a/b<<"\n\n";
			ans=to_string((double)a/b);
			break;
		case '%':
			c=a%b;
	}
	
	if(op!='/')
	{
		cout<<a<<' '<<op<<' '<<b<<" = "<<c<<"\n\n";
		ans=to_string(c);
	}
	
	return true;
}

bool float_calc()
{
    string s1,s2;
    char op;
    double a,b,c;

    cout<<"Input the two floating-point numbers (input \"ans\" to use the result of the previous calculation), or input \"quit\" to return to main menu:\n";
    
    if(s1=="quit")
		return false;
	
	cin>>s2;
	
	if(s2=="quit")
		return false;
	
	a=stod(s1=="ans"?ans:s1);
	b=stod(s2=="ans"?ans:s2);
	
	cout<<"Input the operator(+(add),-(sub),*(multiply),/(divide),%(mod)):";
	cin>>op;

    switch(op)
	{
		case '+':
			c=a+b;
			break;
		case '-':
			c=a-b;
			break;
		case '*':
			c=a*b;
			break;
		case '/':
			c=a/b;
			break;
		case '%':
			c=fmod(a,b);
	}

    cout<<a<<' '<<op<<' '<<b<<" = "<<c<<"\n\n";
}

bool power_calc()
{
    string s1,s2;
    double a,b;

    cout<<"Input two integers or floating-point numbers (input \"ans\" to use the result of the previous calculation), or input \"quit\" to return to main menu:\n";
    
}