这是代码
#include<iostream>
#include<cstring>
#define limit 25
using namespace std;
int main()
{
int te; //Number of test cases
cin>>te;
while(te)
{
char m[limit];
char w[limit];
cin.getline(m,limit); // This line is not getting executed for some reason
cin.getline(w,limit);
cout<<"m "<<m<<" "<<endl<<"w "<<w<<endl;
te--;
}
}
天知道什么原因,机器拒绝读取第一个测试用例的 m。在其他情况下,它读取并打印 m 和 w 的值,但对于第一种情况,它拒绝读取 m。
样本:
INPUT
1
hello
m is
w is hello
2
hello
m
w hello
stack
overflow
m stack
w overflow