0

[Problem solved] Why doesn't sololearn code playground work as vscode or other ides do?

I wrote the first code on vs code and checked if it worked or not as expected. It was pleasing to get no errors there. Then I copied the code and run it on sololearn. And ended up getting the warning: "Expected expression before float" My question is, why isn't it working here although it was working on vscode? https://code.sololearn.com/cNN8uDUN6q5r/?ref=app https://code.sololearn.com/cA1a8a19A0A4/?ref=app

21st May 2021, 3:24 AM
Md Shahriar Rahman
Md Shahriar Rahman - avatar
3 Antworten
+ 3
As I understand it, casting in C is done as follows (target-type) data So the problem in line 27 is the way you cast `int` <letters> into `float`, which should be int average = (int)ceil ( (float) letters / words );
21st May 2021, 4:24 AM
Ipang
+ 1
Well, that's because Sololearn uses a different compiler than the one you use in VSCode and the way you cast is not the correct one.
21st May 2021, 4:09 AM
Edgar Sabido
Edgar Sabido - avatar
+ 1
Thanks for recorrecting Edgar Sabido and Ipang ! I surely should have checked again whether my code was correctly written or not
21st May 2021, 5:37 AM
Md Shahriar Rahman
Md Shahriar Rahman - avatar