當前位置:編程學習大全網 - 編程軟體 - 編程匯文

編程匯文

# include & ltiostream.h & gt

# include & ltstdio.h & gt

# include & ltstring.h & gt

bool IsHuiwen(char *str) {

int len = strlen(str);

for(int i = 0,j = len-1;我& ltj;i++,j -)

if(str[i]!= str[j])返回false

返回true

}

char* GetWord(char *str,int & amp索引)

{

char word[30];

for(;str[index]= =“”;index++);

for(int I = 0;str[index]& amp;& ampstr[index]!= ' ';index++,i++)

word[I]= str[index];

word[I]= ' \ 0 ';

返回單詞;

}

void main()

{

char句子[10000],單詞[30];

int count = 0,index = 0;

gets(句子);

while(句子[索引])

{

strcpy(word,GetWord(sentence,index));

if(is Huiwen(word))count++;

}

cout & lt& lt計數& lt& ltendl

}

  • 上一篇:石雕機啟動後Y軸位置不確定是什麽原因?
  • 下一篇:關於音樂級別指示燈的電路?
  • copyright 2024編程學習大全網