2014年6月25日 星期三
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"); }
修正句首小寫為大寫
INPUT
problem solving consists of using generic or ad hoc
methods, in an orderly manner, for finding solutions to problems. some of the problem-solving techniques
developed and used in artificial intelligence,computer
science, engineering, mathematics, medicine, etc.
OUTPUT
Problem solving consists of using generic or ad hoc
methods, in an orderly manner, for finding solutions to problems. Some of the problem-solving techniques
developed and used in artificial intelligence,computer
science, engineering, mathematics, medicine, etc.
#include <iostream>
#include <string>
using namespace
std;
int main()
{
char
ch;
cin >> ch;
cout << (char)(ch+('A'-'a'));
while(cin
>>noskipws>>ch){
if
(ch!='.'){
cout << ch;
}
else
{
cout << ch; //.
cin >> ch; //space
cout << ch;
cin >> ch;
cout << (char)(ch+('A'-'a'));
}
}
//system("Pause");
}
訂閱:
意見 (Atom)