|
|
вернуться в форумWhat's wrong in this? (C++) Послано pbiiii 15 фев 2013 14:53 #include <iostream> //where is my mistake? using namespace std; int main() { int number, result; cout << "Enter number: " << endl; cin >> number; result = number; if (number > 0 && number <= 10000) { for (int i = 1; i<number; i++) { result = result + i; } } else if (number <= 0 && number >= -10000) { for (int j = 1; j > number; j--) { result = result + j; } } else { cout << "Enter the number within the limits of [-10000;10000]" << endl; return main(); } cout << "Otvet: " << result << endl; return 0; } Re: What's wrong in this? (C++) Edited by author 25.02.2013 22:28 Re: What's wrong in this? (C++) Послано Szenti 13 май 2013 20:53 You should not output any other text, only the solution. Re: What's wrong in this? (C++) You shound't cout any extral words! For example : not cout << "Enter number: " << endl; and change cout << "Otvet: " << result << endl; tocout << result << endl; |
|
|