做题记录--day48

《算法笔记》3.6小节——入门模拟->字符串处理

B题本身没有难度,因为样例后面不是' ',好心的管理员帮忙修改了样例,明天看一下在初始状态下怎么解决这个问题

#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]!='
')
    {
        if(pd==true)
        {
            if(c[count]>='a'&& c[count]<='z')
                c[count]=c[count]+'A'-'a';
            pd=false;
        }
        else if(c[count]==' ' || c[count]=='	'||c[count]=='
' ||c[count]=='
')
        {
            pd=true;
        }
        count++;
    }
    else
    {
        for(int i=0;i<count;i++)
        printf("%c",c[i]);
        printf("
");
        pd=true;
        count=0;
    }
    }
    return 0;
}
View Code
时间才能证明一切,选好了就尽力去做吧!
原文地址:https://www.cnblogs.com/tingxilin/p/11409982.html