企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[TOC] ###(1)分类 ``` #include<stdio.h> #include<string.h> #include<malloc.h> int main () { int n; int i=0,j=0,k=0; char* str; int* p; char* q; scanf("%d\n",&n); str = (char *)malloc(sizeof(char)*(n)); p = (int *)malloc(sizeof(int)*(n)); q = (char *)malloc(sizeof(char)*(n)); scanf("%s",str); for(i=0;i<=n;i++) { if(str[i]>='0'&&str[i]<='9') { p[j++]=str[i]; } else if(str[i]<='z'&&str[i]>='a'||str[i]<='Z'&&str[i]>='A') { q[k++]=str[i]; } } for(i=0;i<=j;i++) { printf("%c",p[i]); } printf("\n"); for(i=0;i<=k;i++) { printf("%c",q[i]); } printf("\n"); return 0; } ``` ### (2)找出矩阵中的字符 ``` int main(void) { printf("hello world"); } ``` ### (3)矩阵翻转 ``` #include<stdio.h> int main() { } ``` ### (4)求和 ``` #include<stdio.h> #include<malloc.h> int main() { int i=0,n,m=0; int sum=0; char* str; scanf("%d",&n); str=(char *)malloc(sizeof(char)*n); scanf("%s",str); while(str[i]!='0') { if(str[i]>='0'&&str[i]<='9') { m=m*10+str[i]-'0'; } if(str[i]=='.'||(i==n-1)) { sum=sum+m;m=0; } i++; } printf("%d\n",sum); return 0; } ```