Do title records --day49

"Algorithm Notes" Section 3.6 - Getting Started Analog -> string processing

B title itself is not difficult, because the back of the sample is not a '\ n', well-intentioned administrator to help modify the sample, look at tomorrow how to solve this problem in the initial state

#include<stdio.h>
#include<string.h>
int main()
{
    char c[1000];
    int count=0;
    bool pd=true;
    while(scanf("%c",&c[count])!=EOF)
    {
    if(c[count]!='\n')
    {
        if(pd==true)
        {
            if(c[count]>='a'&& c[count]<='z')
                c[count]=c[count]+'A'-'a';
            pd=false;
        }
        else if(c[count]==' ' || c[count]=='\t'||c[count]=='\r' ||c[count]=='\n')
        {
            pd=true;
        }
        count++;
    }
    else
    {
        for(int i=0;i<count;i++)
        printf("%c",c[i]);
        printf("\n");
        pd=true;
        count=0;
    }
    }
    return 0;
}
View Code

 

Guess you like

Origin www.cnblogs.com/tingxilin/p/11409982.html