Use cs50.h in SoloLearn | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Use cs50.h in SoloLearn

I just enroll a course of CS50 from Harvard University. They build a header file named "cs50.h". This header file work in their virtual IDE. But when I run this code in SoloLearn it shows error. It is easy to understand that SoloLearn don't know what is "cs50.h" . My question is "Is their any way to include and run cs50.h perfectly?"

27th Oct 2020, 3:06 PM
Emon Hossain Foysal
Emon Hossain Foysal - avatar
6 Answers
+ 4
Martin Taylor i agree with you, back in my college days we would have competitive programming in c from day 1. we were forced to learn how to program the hard way and they would only teach basic algorithms in class. every day the problems get harder and intentionally place edge cases like all sort of input types, int input value that passed int limits, regex input and some data structures that weren't even taught in class. so that we learn it ourself instead of being spoonfed. the class turns to a sort of survival of the fittest and around 80% of them fail, lots even quit. it's a great idea to make sure students really came to computer science to learn and to not rub their ego for entering a STEM field for the paycheck / image. hell, i even created my very own hashmap before even knowing that it's called a hashmap in the first place.
28th Oct 2020, 10:50 AM
Shen Bapiro
Shen Bapiro - avatar
+ 3
Can you share you attempt(and the reason/task) so others can better understand and help where relevant?
27th Oct 2020, 4:26 PM
Lord Krishna
Lord Krishna - avatar
+ 2
Edit: This is not the complete source code. It will need the declarations as martin explained. At this point best would be to try in your own system. Old: Of course it should be possible. Simply paste the cs50.h in codeplayground and include your main function at the very bottom. If everything was done correctly it should work. I verified with this version http://dkui3cmikz357.cloudfront.net/library50/c/cs50-library-c-3.0/cs50.h Tst code: https://code.sololearn.com/cjpzq90fb47j/
27th Oct 2020, 4:06 PM
Lord Krishna
Lord Krishna - avatar
+ 1
Lord Krishna I see you code and try to some change like get_string(), get_int() etc. But it won't work
27th Oct 2020, 4:23 PM
Emon Hossain Foysal
Emon Hossain Foysal - avatar
+ 1
So, this method is for local machine. What about for SoloLearn or an online contest if I want to solve any problem using cs50.h ? That's platform basically don't know what cs50.h is. Right?
28th Oct 2020, 3:18 AM
Emon Hossain Foysal
Emon Hossain Foysal - avatar
0
https://code.sololearn.com/c92uTOv3y9aR/?ref=app I want to run this code without any error. Can you do this?
27th Oct 2020, 4:28 PM
Emon Hossain Foysal
Emon Hossain Foysal - avatar