杭电2026题答案

#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;

int main(int argc, char *argv[])
{
    int len;
    char str[100];
    while(gets(str))
    {
      len=strlen(str);
      str[0]=str[0]-32;
      for(int i=1;i<len;i++)
      {
        if(str[i]==' ')
          str[i+1]=str[i+1]-32;
      }
      for(int i=0;i<len;i++)
        printf("%c",str[i]);
      cout<<"\n";
    }
    system("PAUSE");
    return EXIT_SUCCESS;
}

posted @ 2012-07-27 10:31  Marshalkk  阅读(359)  评论(0编辑  收藏  举报