請編寫函式fun,它的功能是統計指定字串中字母字元的個數並返回統計結果。請在主函式main中呼叫它

2021-07-05 13:40:37 字數 1220 閱讀 1556

1樓:匿名使用者

#include

int fun(char *psztext, int nlen)}return ncount;

}void main()

2樓:

#include

int fun(const char* buf)return count;

}int main(void)

3樓:匿名使用者

#include

void fun(char str);

int main(void)

void fun(char str)

else if ((*str>='a' && *str<='z') || (*str>='a' && *str<='z'))

else if (*str == ' ')else

str++;

}printf("字母數為:%d \n", nchar);

printf("數字數為:%d \n", nnum);

printf("空格數為:%d \n", nspace);

printf("其它為 :%d \n", nother);}

4樓:匿名使用者

#include

#include

int func(char *str)

return sum;

}int main()

請編寫一個函式fun, 其功能是:統計一行字串中單詞的個數,作為函式值返回。

5樓:匿名使用者

#include

#include

int wordscounter(char *str);

int main()

int wordscounter(char *str)return count;}

6樓:匿名使用者

#include

#include

#define n 80

int fun( char *s)

if(s[i]==' '&&f==0)

}return cnt;

}int main()

7樓:匿名使用者

int fun( char *s)

return c;}

fun四編寫函式fun,函式的功能是 求四位數的各

dim a as integer,b as integer,c as integer,d as integer,m as integer private sub command1 click m val text1.text msgbox 該四位數各位立方和為 fun m end sub funct...

編寫函式,它的功能是統計字串中所有字母的出現次數,字母不區分大小寫

執行了一遍,正確,只是不區分大小字母 能執行,但是有些細節不是太好。比如,a這個陣列的長度,編寫函式,統計給定字串中各個字母出現的次數,不區分大小寫 比如對hello,tom 進行統計 void count chars char s,int cnt main int i count chars s,...

程式設計c語言請編寫函式proc它的功能是求

include int proc int m,int a int main scanf d m n proc m,s for i 0 i printf d,s i return 0 int proc m int count 0 bool stop false while stop false pri...