⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compare.cpp

📁 配对比较
💻 CPP
字号:
#include<iostream.h>

void Typecompare(int x,int y);

void main()
{
	int alow,ahigh,blow,bhigh;

	alow=4,ahigh=9;

	int b[2][14];

	int i;

//	cout<<"alow=";
//	cin>>alow;
//	cout<<"ahigh=";
//	cin>>ahigh;

	for(i=1;i<=13;i++)
	{
		cout<<"第"<<i<<"组:"<<endl;
		cout<<"blow=";
		cin>>blow;
		cout<<"bhigh=";
		cin>>bhigh;
		
		b[0][i]=blow,b[1][i]=bhigh;
	}

	for(i=1;i<=13;i++)
	{
		cout<<"第"<<i<<"组:"<<endl;
		cout<<"blow="<<b[0][i]<<",bhigh="<<b[1][i]<<endl;
		blow=b[0][i],bhigh=b[1][i];

		cout<<"alow";
		Typecompare(alow,blow);
		cout<<"blow"<<"	";
		
		cout<<"alow";
		Typecompare(alow,bhigh);
		cout<<"bhigh"<<"	";
		
		cout<<"ahigh";
		Typecompare(ahigh,bhigh);
		cout<<"bhigh"<<"	";
		
		cout<<"ahigh";
		Typecompare(ahigh,blow);
		cout<<"blow"<<endl;
	}	

}

void Typecompare(int x,int y)
{
	if(x==y)
		cout<<"=";
	else
		if(x>y)
			cout<<">";
		else
			cout<<"<";
		
/*
	switch(x-y)
	{
	case =0: cout<<"=";break;
	case >0: cout<<">";break;
	case <0: cout<<"<";break;
	default: break;
	}
*/
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -