|
|
вернуться в форумwrong answer #1 Послано Dejust 26 фев 2011 21:32 Re: wrong answer #1 Послано Dejust 27 фев 2011 15:45 my code: #include <string> #include <iostream> using namespace std; int main() { string line; getline(cin, line); static bool sing = false; for(int i = 0; i < line.length(); i++) { if(sing) { if((line[i] >= 'A') && (line[i] <= 'Z')) { char temp = line[i] - ('A'-'a'); cout << temp; } else if((line[i] == '.') || (line[i] == '!') || (line[i] == '?')) { cout << line[i]; sing = false; } else if(line[i] == 10 || line[i] == 26) { cout << '\n'; } else { cout << line[i]; } } else { if(line[i] >= 'A' && line[i] <= 'Z') { cout << line[i]; sing = true; } else if(line[i] == 10 || line[i] == 26) { cout << '\n'; } else if((line[i] == '.') || (line[i] == '!') || (line[i] == '?')) { cout << line[i]; } else { cout << line[i]; } } } return 0; } Re: wrong answer #1 Cause your first char is lower? but it should be upper.. |
|
|