主题:问题
#include<iostream>
using namespace std;
int main()
{
int n=0;
char str[80]="beijing-china2008";
cout<<str<<endl;
while(str[n]!='\0')
str[n++]=str[n]>='a'&&str[n]<='z'?str[n]-'a'+'A':str[n];
cout<<str<<endl;
return 0;
}
为什么结果会等于
beijing-china2008
BEIJING-CHINA2008
求解
using namespace std;
int main()
{
int n=0;
char str[80]="beijing-china2008";
cout<<str<<endl;
while(str[n]!='\0')
str[n++]=str[n]>='a'&&str[n]<='z'?str[n]-'a'+'A':str[n];
cout<<str<<endl;
return 0;
}
为什么结果会等于
beijing-china2008
BEIJING-CHINA2008
求解