Why is this c++ code not working . | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why is this c++ code not working .

This code runs very well in turbo c++ And not running in this solo learn plaground why is it so. Please help me if I am misunderstanding some concepts. https://code.sololearn.com/cTVqYQkKC0S8/?ref=app

22nd May 2019, 2:19 PM
Ayush Pandey
Ayush Pandey - avatar
11 Answers
+ 5
Problems: You are using a very old compiler. C++ is regularly updated. Sololearn support the modern version of C++. The return type of main must be int.
22nd May 2019, 3:29 PM
Ayush Sinha
Ayush Sinha - avatar
+ 3
~ swim ~ it would tell me mine java version which I upgrade regularly but what is taught in schools is unknown
22nd May 2019, 3:32 PM
Ayush Pandey
Ayush Pandey - avatar
+ 3
I have also studied c++ in school and was also confused. I think you should learn latest c++ code in school just replace some part of program. Add .h at end of header file Remove using namespace std; Use void main and don't return 0 This you have to do in school.
23rd May 2019, 12:21 PM
Abhinav
+ 2
You are writing code in a very very old compiler. C++ is regularly updated with enhanced features. In Solo learn we have write a latest c++ 11 / 14 /17 code i.e. #include<iostream> using namespace std; int main() { cout<<"hello everyone ...."; return 0; } For more information go to the course in Solo learn.
22nd May 2019, 2:51 PM
Abhinav
+ 2
Abhinav Bhardwaj i have gone through the courses in sololearn but i got confused when i saw these programs and one which was taught in my school
22nd May 2019, 2:53 PM
Ayush Pandey
Ayush Pandey - avatar
+ 2
Abhinav Bhardwaj thank you for your explanation but I have one more doubt can we use void in main
22nd May 2019, 2:54 PM
Ayush Pandey
Ayush Pandey - avatar
+ 2
this program can work in turbo because according to new cpp main have integer return type not void and conio is non standard library which present only in turbo compiler. change these things and then your program works
23rd May 2019, 1:52 AM
Ameer Wajid Ali
Ameer Wajid Ali - avatar
+ 1
may be cause it is accepted by our school's board but now it's all java in our syllabus c++ was initial language ~ swim ~
22nd May 2019, 3:06 PM
Ayush Pandey
Ayush Pandey - avatar
+ 1
~ swim ~ what is meant by the version ?? jdk version??
22nd May 2019, 3:10 PM
Ayush Pandey
Ayush Pandey - avatar
+ 1
~ swim ~ well I am not quite sure which is the version as we are used to with blueJ as our IDE and I am not sure which version we are taught
22nd May 2019, 3:21 PM
Ayush Pandey
Ayush Pandey - avatar
0
It's obvious; cuz you deleted the code "using namespace std;" and didn't add "std :: " before the "cout" method.
5th Jun 2019, 4:36 PM
Arashk
Arashk - avatar