+ 1

Apparently the c compiler is different from another application I have, can anyone tell me what it is? Should I change the code?

Created a code in an app that compiled the lenguage C, and when passed to Sololearn the run is different , and this program is not functional. https://code.sololearn.com/ccHVJ1mSGH1S/?ref=app

3rd Jan 2022, 9:58 PM
Lilian Infante de la Cruz
Lilian Infante de la Cruz - avatar
12 odpowiedzi
+ 2
I know to use the switch, still so used it this way. The space between the " and the % is in order that remains to a certain distance when printing the code, is not an error.
3rd Jan 2022, 11:11 PM
Lilian Infante de la Cruz
Lilian Infante de la Cruz - avatar
+ 2
No para nada
3rd Jan 2022, 11:12 PM
Lilian Infante de la Cruz
Lilian Infante de la Cruz - avatar
+ 2
Lo compilaste ? Pruebalo a ver si te funciona
3rd Jan 2022, 11:15 PM
Lilian Infante de la Cruz
Lilian Infante de la Cruz - avatar
+ 2
Si en el código falta algún ; es un error a la hora de copiarlo del portapapeles
3rd Jan 2022, 11:58 PM
Lilian Infante de la Cruz
Lilian Infante de la Cruz - avatar
+ 1
Es bueno saberlo, (lo de los bucles infinitos en sololearn
4th Jan 2022, 12:00 AM
Lilian Infante de la Cruz
Lilian Infante de la Cruz - avatar
0
What library you imported ? Sololearn may haven't 1 or more of them
3rd Jan 2022, 10:27 PM
VCoder
VCoder - avatar
0
This seems wrong to me: scanf(" %c", &letra); Why the space before char? BTW, did you do the lessons on "switch" statement? The long "if" sequence is what we call "code smell".
3rd Jan 2022, 11:06 PM
Emerson Prado
Emerson Prado - avatar
0
El espacio en el scanf no exije que el usuario tambien lo incluye en la entrada?
3rd Jan 2022, 11:11 PM
Emerson Prado
Emerson Prado - avatar
0
Solo que tampoco cumple su propósito , en la entrada que se pide no se conserva ese espacio
3rd Jan 2022, 11:13 PM
Lilian Infante de la Cruz
Lilian Infante de la Cruz - avatar
0
My impression is that the code keep variables values between loops, despite the scanf at the beginning. I don't know why.
3rd Jan 2022, 11:25 PM
Emerson Prado
Emerson Prado - avatar
0
1_you missed a ; in the last printf() call (in case the input is invalid) 2_Sololearn doesn't support infinite loops as ( trunc ) returns the pointer address of the trunc() function of math which evaluates to true, to test your program i had to use : do {...} while(false);
3rd Jan 2022, 11:29 PM
VCoder
VCoder - avatar
0
I ran in code playground itself. But VCoder answer reminded me of another thing the code playground doesn't support: input loops. It can only take all inputs at once, in the beginning of the execution. So, in code playground, you have to remove the loop, or use Vcoder's trick to limit it to a single run.
4th Jan 2022, 12:01 AM
Emerson Prado
Emerson Prado - avatar