C++输出汉字的方法

it2022-05-09  26

/*WplC++输出汉字的方法2009,05,30,1:37*/#include <iostream>#include <string>using namespace std;string str="汉字里有english也能正确显示,hehe";

int main() {  int i = 0,len=str.length();  while (i<len)  {    if(str[i] < 0)  {       printf("%c%c", str[i], str[i+1]);       i++;    }    else  {      printf("%c", str[i]);    }    i++;  }  return 0;}

 

转载于:https://www.cnblogs.com/forever4444/archive/2009/05/30/1491948.html

相关资源:输出汉字版得“你好 世界!”代码(vc )

最新回复(0)