+ 2

BIG PROBLEM?!!!

Sololearn update its compuler and this code is not working help me fast https://code.sololearn.com/c8OU9RE5AvfO/?ref=app

27th Nov 2018, 2:15 AM
Arun
9 odpowiedzi
+ 3
I guess so; I can't say for sure as I don't code in C++. I have been using Python for about 6 months, and I never needed anything other than the input() function to get user inputs, which doesn't seem to have these issues. But there are many "basic" problems like that. So if you use a more descriptive title, it'd help those who know the answer get to you faster. Moreover, those who are struggling with the same issue would be able to find the post easily by using the search bar. Check out this nice blog post on this topic: https://www.sololearn.com/Blog/38/8-simple-rules-to-get-help-from-the-community/
27th Nov 2018, 8:35 AM
Kishalaya Saha
Kishalaya Saha - avatar
+ 9
i dont see any error in the code...
27th Nov 2018, 2:31 AM
LONGTIE👔
LONGTIE👔 - avatar
+ 2
It might help if you specify what inputs you're using. [Note, the compiler version looks the same to me]
27th Nov 2018, 2:52 AM
Kirk Schafer
Kirk Schafer - avatar
+ 2
I think the issue is that you're entering the input for A in the second line. If you type something like 2<enter>Arun<enter> Then cin>>n reads just 2, leaving the newline character in the stream. Then for A, it tries to read from the same line, sees the newline character and stops. Fix: 1. Enter both of them in the same line. 2. Use something like cin.ignore() before reading A. I may be wrong though, I don't really speak C++. Perhaps others can guide you better. P.S. Why have you tagged all these languages? This is most certainly not a Python problem, for example. And please use a more descriptive title than "BIG PROBLEM?!!!". Thanks!
27th Nov 2018, 4:22 AM
Kishalaya Saha
Kishalaya Saha - avatar
+ 2
Is your problem that you don't get a proper output if you enter letters for the first cin? In that case try to add this line above the second input: cin.clear();
27th Nov 2018, 9:51 AM
HonFu
HonFu - avatar
+ 1
try again dude
27th Nov 2018, 2:34 AM
Arun
+ 1
string is not coming
27th Nov 2018, 2:34 AM
Arun
+ 1
help fastttt
27th Nov 2018, 2:39 AM
Arun
0
i thought that it is a basic problem that everyone can face later in their programming life
27th Nov 2018, 8:09 AM
Arun