0

Is it just me or do the C++ cin statements in the code playground not work the way we want them to?

Whenever I use cin in a program, and run the program, and try to print the user inputted value, the program doesnt provide and option for value input and gives a seemingly random value...is this a problem faced by ever user in the SoloLearn platform? Or is it happening because my program has some errors?

20th Mar 2020, 7:15 AM
Ishaan Kashyap
9 Respuestas
+ 4
If the code playground works and when executing your program it only requests data entry once, but if your program requires more than one data entry you must enter them using a line break
20th Mar 2020, 7:20 AM
Cmurio
Cmurio - avatar
+ 4
You can upload your code to analyze some syntax problem if you want
20th Mar 2020, 7:24 AM
Cmurio
Cmurio - avatar
+ 3
Its correct
20th Mar 2020, 7:36 AM
Cmurio
Cmurio - avatar
0
Jesus Eduardo Canul Koyoc I've done that...the program doesnt request data entry AT ALL. All it does is print a value, without any data entry. I've used line breaks for programs with multiple cin statements, and the same problem occurs...
20th Mar 2020, 7:23 AM
Ishaan Kashyap
0
Sometimes you need to check whether you have written the code correctly or not because if you copy code from another executor to here it might not get correct.
20th Mar 2020, 8:31 AM
Faruque Aziz
Faruque Aziz - avatar
0
If you don't write a number, it will print 0, because the default value of int is 0, and, since you arent giving any value to a, it will be 0.
20th Mar 2020, 11:33 AM
Fernando Pozzetti
Fernando Pozzetti - avatar
0
For example #include <iostream> using namespace std; int main() { int a = 1000; cout << "Enter a number: \n"; cin >> a; cout << "Your number is:" << a ; return 0; } Will output 1000 if you dont write any number in the input window.
20th Mar 2020, 11:34 AM
Fernando Pozzetti
Fernando Pozzetti - avatar
0
Fernando Pozzetti Thanks, but I'm pretty sure my code is correct... The input option isn't working, and plus, I Jesus Eduardo Canul Koyoc already verified the code... Must be some error in SoloLearn
20th Mar 2020, 2:37 PM
Ishaan Kashyap