【演習】アルゴリズムノート発行B:大文字(文字列の配列への直接入金)

参考https://blog.csdn.net/qq_40073459/article/details/86559451

問題は次の2つのスペースを入力すると、間違っているかもしれないですがあります。しかし、このアイデアは取得、必ずしもそれが本をコピーします。

#include <cstdio>
#include <string.h>

//直接就存到一维数组 
int main()
{
  char str[100];
  while(gets(str)){
  	
  	int i=0;
  	do{
  		if(str[i] >='a' && str[i]<='z') 
  			str[i] -=32;  //直接对第一个字母转换 

  		for(i++; str[i]!=' ' && str[i] !='\n' && str[i]!='\r' && str[i]!='\t'; i++);
  		
		i++;
  	}while(str[i] !='\0' );
  	
  	puts(str);

  }

  return 0;
}

 

公開された63元の記事 ウォン称賛13 ビュー40000 +

おすすめ

転載: blog.csdn.net/changreal/article/details/88244706