💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
(1)分类 (2)找出矩阵中的字符 (3)矩阵翻转 (4)求和 (1)分类 #include <stdio.h> int main(void) { int m,x; int i=0,j=0; char c; scanf("%d",&m); int myInt[m]; char myChar[m]; for(x=0;x<=m;x++) { c = getchar(); if('0'< c && c <'9') { myInt[i] = c-'0'; i++; } else { myChar[j] = c; j++; } } for(x = 0;x<i;x++) { printf("%d",myInt[x]); } printf("\n"); for(x = 1;x<j;x++) { printf("%c",myChar[x]); } } (2)找出矩阵中的字符 #include <stdio.h> #include <string.h> } } (3)矩阵翻转 #include <stdio.h> ; } (2)找出矩阵中的字符 #include <stdio.h> #include <string.h> } } (3)矩阵翻转 #include <stdio.h> } } (4)求和 #include <stdio.h> int main(void) { int strLength = 15; scanf("%d",&strLength); char str[strLength+1]; int myNumber[strLength]; scanf("%s",str); int x = 0; int i = 0; int j = 0; int sum = 0; for(i=0;i<strLength;) { myNumber[j] = 0; while(i<strLength && str[i] != '.') { myNumber[j] = 10 * myNumber[j] + str[i++] - '0'; } ++i; ++j; } for(x=0;x<j;x++) { sum += myNumber[x]; } printf("%d",sum); return 0; }