#include<iostream>
#include<iomanip>
using namespace std;
void yiwei()
{
	int chengshu, beichengshu;
	cout << "一位乘法(请从大到小输入)" << endl;
	cin >> chengshu >> beichengshu;
	system("cls");
	cout << setw(7) << chengshu << endl;
	cout << setw(1) << "×" << setw(5) << beichengshu << endl;
	cout << setw(7) << "-------";
	cout << endl;
	cout<<setw(7)<< beichengshu * chengshu;

	
}
void erwei()
{
	int chengshu, beichengshu;
	cout << "两位乘法(请从大到小输入)" << endl;
	cin >> chengshu >> beichengshu;
	system("cls");
	cout << setw(7) << chengshu << endl;
	cout << setw(1) << "×" << setw(5) << beichengshu << endl;
	cout << setw(7) << "-------";
	cout << endl;
	cout << setw(7) << chengshu * (beichengshu % 10) << endl;
	if (beichengshu/10!=0)
	{
		cout << setw(6) << chengshu * (beichengshu / 10) << endl;
		cout << setw(7) << "-------" << endl;
		cout << setw(7) << beichengshu * chengshu;
	}

	
}
void sanwei()
{
	int chengshu, beichengshu,weishu;
	cout << "3位乘法(请从大到小输入)" << endl;
	cin >> chengshu >> beichengshu;
	cout << "最小几位数?";
	cin >> weishu;
	system("cls");
	switch (weishu)
	{
	case 1:cout << setw(7) << chengshu << endl;
		cout << setw(1) << "×" << setw(5) << beichengshu << endl;
		cout << setw(7) << "-------";
		cout << endl;
		cout << setw(7) << beichengshu * chengshu;
		; break;
	case 2:cout << setw(7) << chengshu << endl;
		cout << setw(1) << "×" << setw(5) << beichengshu << endl;
		cout << setw(7) << "-------";
		cout << endl;
		cout << setw(7) << chengshu * (beichengshu % 10) << endl;
		cout << setw(7) << chengshu * (beichengshu / 10) << endl;
		cout << "-------";
		cout << endl;
		cout << beichengshu * chengshu;
		break;
	case 4:NULL;cout<<"你大爷的";
	default:cout << setw(7) << chengshu << endl;
		cout << setw(1) << "×" << setw(5) << beichengshu << endl;
		cout << setw(7) << "-------";
		cout << endl;
		cout << setw(7) << chengshu * (beichengshu % 10) << endl;
		cout << setw(7) << chengshu * ((beichengshu % 100)/10) << endl;
		cout << setw(7) << chengshu * (beichengshu / 100) << endl;
		cout << setw(7) << "-------" << endl;
		cout << setw(7) << beichengshu * chengshu;
		break;
	}
}
int main()
{
	short i;
	cout << "最大几位数(1~3)?";
	cin >> i;
	switch (i)
	{
	case 1:yiwei();return 0; break;
	case 2:erwei();return 0; break;
	case 3:sanwei(); return 0; break;
	default:
		break;
	}
	while (true)
	{

	}
}