+ 1

Help me to debug my code, plz. C++

Process 15 integers as follows: find the number of negative numbers, the number of zeros and calculate the sum positive numbers. Program without using an array: Here is my attempt: https://code.sololearn.com/c4qt2i9ZzZNh/?ref=app

11th Mar 2021, 9:45 AM
Anthony
Anthony - avatar
2 ответов
+ 5
Just like Martin Taylor said, it is possible to use scanf() and printf() in C++ also. But here the problem is due to the poor implementation of Sololearn's code playground. Code playground only prompts user to enter data in input file only when it encounters "cin" in a C++ code, and as your code doesn't have it, so it is assumed that your code doesn't take any input and code playground sends an empty input file to their server resulting in every input operation via scanf() to give undesired results. Note that scanf() and printf() are still working (if writen correctly) it's just that because of absence of "cin", sololearn is not making us fill the input file before sending it to their servers to compile and run. Here is a minimum working example (MWE) showing you so 👇 https://code.sololearn.com/c7SQ48HrRJoX/?ref=app
11th Mar 2021, 1:41 PM
Arsenic
Arsenic - avatar
+ 1
scanf and printf are declared in C . use cin >> and cout << respectively. cin >> : is for take an input from the user cout << : is for printing some data in the console https://www.programiz.com/cpp-programming/library-function/iostream/cout#:~:text=The%20cout%20object%20in%20C%2B%2B,standard%20C%20output%20stream%20stdout.
11th Mar 2021, 11:54 AM
Med Amine Fh
Med Amine Fh - avatar