1樓:取什麼名字才好呢啊哦
#include
using namespace std;
void main ()
cout<<"number="< 2樓:匿名使用者 #include main() /* count digits, white space, others */ }printf("digits ="); for (i = 0; i < 10; i++)printf(" %d", ndigit[i]); printf(", white space = %d, other = %d\n", nwhite, nother); return 0;} 3樓:匿名使用者 /* note:your choice is c ide */#include "stdio.h" int num,letter,blank,other; void main() void total(char str1[20]) } 4樓:匿名使用者 #include #include int letter,number,blank,other; void count(char str) int i; for(i=0;str[i]!='\0';i++)if((str[i]>='a'&&str[i]<='z')||(str[i]>='a'&&str[i]<='z')) letter++; else if(str[i]>='0'&&str[i]<='9')number++; else if(str[i]==' ') blank++; else other++; int main() char a[80]; gets(a); puts(a); strcat(a,"\0"); letter=0; number=0; blank=0; other=0; count(a); printf("\n%5d,%5d,%5d,%5d\n",letter,number,blank,other); return 0; 用c語言編寫:編寫乙個函式,由實參傳來乙個字串,統計此字串中字母,數字,空格和其他字元的個數 5樓:敬問鮃 不用全域性變數 #include int main() void tongji(char s) printf("其中大寫字母有%d個,小寫字母有%d個\n空格有%d個,數字有%d個,其他字元有%d個\n",d,x,k,z,q); }用全域性變數 #include int d=0,x=0,k=0,z=0,q=0; void main() void tongji(char s[20])} 6樓:匿名使用者 #include #include void countchar(char* pszinput)c = *pszinput; while ('\0' != c) else if (isspace(c)) else if (c >= '0' && c <= '9')else c = *(++pszinput); }printf ("字母個數:%d\n", ialpha); printf ("數字個數:%d\n", inumber); printf ("空格個數:%d\n", ispace); printf ("其他字元個數:%d\n", iother); }int main() 7樓:木芽鐘 #include main() 8樓:雷曉 都很好,很強大,我自愧不如的了 9樓: #include int main() void fun_char(char a)printf("字母有%d\n空格有%d個\n數字有%d個\n其他字元有%d個\n",x,z,p,q);} c語言 編寫乙個函式,由實參傳來乙個字串,統計字串中字母,數字,空格和其他字元的個數,在主函式 10樓:育知同創教育 參考以下** #include int main() void sum(char *ch) printf("character:%d\tnumber:%d\tothers:%d\n",character,number,others);} 函式宣告在main的外面,強烈建議直接把函式寫在前面省的宣告了加上字串的標頭檔案string.h。迴圈直接用strlen獲取長度計算,你這樣子看起來太傻了。要返回多個整數的話可以用結構體做返回值,或者用指標 引用 做引數。char ch是指標的意思,初學者不行就用全域性變數。 汽水 char ch,... 給你個參考參考,寫的很不錯的,不過不是我寫的啦 include char dstr char s,char c int main char str 1000 char ch printf 請輸入乙個字串 t gets str printf 請輸入要挖去的字元 t scanf c ch printf ... 城凝慶偉博 include define n100 intinput char a,char b 輸入兩個字串 intmy strcmp char a,char b 比較字串每個字元的大小 else if a b else if a 0 b 0 字串b比字串a長 else if a 0 b 0 字串...C語言 編寫函式,由實參傳來字串,統計此字串中字母,數字,空格和其他字元的個數
c語言 字串,輸入字元,編寫函式dstr將輸入的字元從字串中刪去。要求能調通
編寫C語言函式,比較兩個字串的大小