#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
void input_Row_Column(int a[])
{
//cout << "请输入两个整数要求大于0且小于1000" << endl;
char c = ' ';
int i = 0;
while ((c = getchar()) != '\n')
{
if (c != ' ')//把这句判断条件改动
{
ungetc(c, stdin);
cin >> a[i++];
}
}
//++++需要通过asscii码判断如果不是整数则.......
}
void main()
{
//1 定义变量 并得到合理区间的T值 [1, 10]
int T = 0; //数据数组 T
vector<string> strs;
bool TisRight = true;//
cin >> T;
while (TisRight)
{
if (1 <= T & T <= 10)
{
TisRight = false;
}
else
{
cin >> T;
}
}
//cout << T << endl;
//2 多个矩阵以及对应的行列数
int N = 0;
cin >> N;
//cout << N << endl;
int row = 0, column = 0; //矩阵的行和列
int a[2] = { 0, 0 };
vector<int> nums;
vector<vector<int>> allNum;
for (size_t i = 0; i < T; i++)
{
for (size_t j = 0; j < N+1; j++)
{
input_Row_Column(a); //++++bool来提高程序的鲁棒性
row = a[0];
column = a[1];
nums.push_back(row);
nums.push_back(column);
}
nums.erase(nums.begin());
nums.erase(nums.begin());
//这儿的思路不对,如果是4对的怎么
int num = 0;
if (nums[1] == nums[2] && nums[0] == nums[4] && nums[3] == nums[5])
{
strs.push_back("yes");
//cout << "yes" << endl;
}
else
{
strs.push_back("no");
//cout << "no" << endl;
}
nums.clear();
allNum.clear();
}
vector<string>::iterator iter;
iter = strs.begin();
while (iter != strs.end())
{
cout << *iter <<endl;
iter++;
}
//system("pause");
}
随意组合的意思
最后一个结果不对,没想明白?