第十次作业

#include<stdio.h>
#include<string.h>
main(){
    int i=0;
    char str[50]="wo ai c yuyan";
    while(str[i]!='\0'){
        i++;
    }
    printf("%d\n",i);

 

 

#include<stdio.h>
main(){
    char str[20];
    int i,j;
    i=j=0;
    gets(str);
    while(str[i]!='\0'){
        if(str[i]!='*')
            str[j++]=str[i];
        i++;
    }
    i=0;
    while(i<j)
        putchar(str[i++]);
}

 

 

#include<stdio.h>
main(){
    char a[20],b[20];
    int i,j;
    gets(a);
    for(i=j=0;a[i]!='\0';i++){
        b[j++]=a[i];
        if((i+1)%3==0)
            b[j++]=' ';
    }
    b[j]='\0';
    puts(b);
}

 

 

#include<stdio.h>
main(){
    char str[20];
    int i,cnt;
    cnt=i=0;
    gets(str);
    while(str[i]!='\0');{
        if(str[i]>='A'&&str[i]<='Z')
            cnt++;
        i++;
    }
    printf("大写字母的个数为:%d\n",cnt);

}

 

 

#include<stdio.h>
main(){
    char str[80];
    int i=0;
    gets(str);
    while(str[i]!='\0'){
        if((i+1)%2==1&&str[i]%2==0)
            putchar(str[i]);
        i++;
    }
}

 

posted @ 2021-12-08 17:29  张瑶~  阅读(21)  评论(0编辑  收藏  举报