刚开始用string来输入,发现不对,string 必须输入两个'\n', 或连续输入两个字符串,才能输出第一个字符串……还有输入需要放进while(1)内
#include<iostream>
#include<string>
using namespace std;
int isupper( char c){
if ( c >= 'A' && c <= 'Z' ) return 1;
return 0;
}
int main()
{
int t;
scanf("%d%*c",&t);
while(t--)
{
char qian,hou;
while( 1 ) {
qian = getchar();
if( qian != ' ' ) {
if( isupper(qian) ) putchar( qian );
else putchar(qian-32);
break;
}
}
while( 1 ) {
hou = getchar();
if( hou == 10 ) break;
if( qian == ' ' && hou != ' ' ) {
if( isupper(hou) ) putchar(hou);
else putchar( hou - 32 );
}
qian = hou;
}
putchar(10);
}
return 0;
}