課程
/后端開發
/C
/C語言入門
求程序
2017-12-07
源自:C語言入門 1-2
正在回答
++i的話就是從1開始了,不是從0 開始
#include<stdio.h>
void main()
{
?int?n=0;
????char *p,str[100];
????scanf("%s",str);
????p=str;
while(*p!='\0')
if(*p>='0'&&*p<='9')
n++;
}
p++;
printf("%d\n",n);
#include<stdio.h> #include<string.h> int?main() {? int?n,count,i,k; ?char?a[500]; ?scanf("%d",&n); ?while(n--) {? ??count=0; ??scanf("%s",&a); ??k=strlen(a); ??for(i=0;i<k;i++)? ???if(a[i]<'A') ????count++; ??printf("%d\n",count); ?}? ?}
舉報
C語言入門視頻教程,帶你進入編程世界的必修課-C語言
2 回答給定一個只有小寫英文字母組成的字符串,串長為n。請你編寫程序求出這個字符串中出現次數最多的字母。
1 回答輸入一個由數字字符組成的字符串,將其轉換為對應的十進制數字,再逆序輸出該數字。
2 回答寫一個函數,求一個字符串的長度,在main函數中輸入字符串,并輸出其長度。
1 回答字符串提取數字
4 回答字符串函數
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2017-12-07
++i的話就是從1開始了,不是從0 開始
2017-12-07
#include<stdio.h>
void main()
{
????char *p,str[100];
????scanf("%s",str);
????p=str;
while(*p!='\0')
{
if(*p>='0'&&*p<='9')
{
n++;
}
p++;
}
printf("%d\n",n);
}
2017-12-07