第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

不知道哪里邏輯錯誤

不知道哪里邏輯錯誤

C
qq_nanranlanW_0 2017-05-14 16:24:28
輸入字符串,實現(xiàn)單詞的分離并計數(shù)用函數(shù)不知道為什么編譯出來什么word【i】根本沒有沒有語法錯誤。strC是計數(shù),記錄每個word【i】出現(xiàn)地次數(shù)str是保存字符串word【】【】是一個單詞一個word【i】求幫忙看一下,自己debug了一整天都不行,初學(xué)C語言,拜托指點一下。#include <stdio.h>#include <string.h>#include<conio.h>#include<ctype.h>#define M 1000#define N 20void beep();void GetPassage(char str[]);void WordSepa(char str[],int strC[],char word[][20]);void main(){?char str[M];?int strC[N];?char word[M/N][N];?GetPassage(str);?printf("%s\n",str);?WordSepa(str,strC,word);}void beep(){?printf("\07");}void GetPassage(char str[]){?char ch;?int i=0;?while(1){?ch=getch();?if(ch=='\r')??break;???? if(ch=='\b'){??if(i>0){??printf("%c %c",ch,ch);???i--;??}??else???beep();??continue;?}?if(ch!=32&&ch!=44&&ch!=46&&isalpha(ch)==0){??beep();??continue;}?if(i<N){?printf("%c",ch);? str[i++]=ch;?}?else?? beep();??}?str[i]='\0';}void WordSepa(char str[],int strC[],char word[][20]){int i=0,j=0,k=0,t=0,x=0;while(j<t) {for(;str[j]==32;j++);while(k<N&&str[j]!=32) word[i][k++]=str[j++];word[i][k]='\0';strC[i]=1;for(x=0;x<i;x++) if(stricmp(word[i],word[x])==0){strC[x]++;i--; break; }i++; k=0;}t=0; for(;t<i;t++)printf("%s(%d)\n",word[t],strC[t]);}
查看完整描述

1 回答

?
Stardust1001

TA貢獻(xiàn)261條經(jīng)驗 獲得超78個贊

一天?也牛逼了。我不清楚了,一年多沒寫C了,難道字符串?dāng)?shù)組不是用指針的嗎?
查看完整回答
反對 回復(fù) 2017-05-19
  • 1 回答
  • 0 關(guān)注
  • 1273 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號