2014年6月16日 星期一

修正句首小寫為大寫(L)

#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main () { 
 vector<char> st;
 char ch;
  
 while(cin >>noskipws>>ch){
  st.push_back(ch);
 }
 
 for(int i=0;i<st.size();i++){
  if(i==0){
   st[i]=st[i]+'A'-'a';
   cout<<st[i];
   continue;
  }
  else if(st[i]=='.'&&(i+2)<st.size()){
   st[i+2]=st[i+2]+'A'-'a';
   cout<<st[i];
   continue;
  }  
  else{
   cout<<st[i];
  }
 }
 
 system("pause");
}
  
 

沒有留言:

張貼留言