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?
9 odpowiedzi
+ 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
+ 4
You can upload your code to analyze some syntax problem if you want
+ 3
Its correct
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...
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.
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.
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.
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