i want to know about all the bad habits in C++ programming
like using 1)goto statement
2)calling main() function etc...
i want to know about all the bad habits in C++ programming
like using 1)goto statement
2)calling main() function etc...
It might be good to start with the good habits. Books like Scott Meyers' Effective C++ series and Stephen Dewhurst's C++ Common Knowledge can help (though some parts may be a little dated now that C++11 is around).
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
i am a fast learner and i have v tight schedule all day so please mention some MAJOR points here i have to study rest 4 subjects too(maths, phy ,chem and english)
Borrow those books from your local library. They are written in a format that allows you to go directly to specific points.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
So have you been set a question that requires you to discuss bad programming practices?
Thought for the day:FLTK: "The most fun you can have with your clothes on.""Are you sure your sanity chip is fully screwed in sir?" (Kryten)
Stroustrup:
"If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"
@ laserlight got it online at http://www.cs.bgu.ac.il/~sagieg/book...tive%20C++.pdf
@rogster yeah i actually realized that i m having some bad practices in C++
Well, if you learn good practices, then you will find that you will have less recourse to bad ones because the good alternatives come to mind more easily.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
okay now i would like to ask you that what is the use of 'cerr' in C++??? it just clicked in my mind right now
and another one....why i am not able to use graphics.h header file?
is the code right ?
Code:#include<graphics.h> #include<stdlib.h> void main() { system("cls"); int a=DETECT,b; initgraph(&a,&b,""); circle(100,100,10); getch(); }
Last edited by Mukul Kumar; 04-18-2013 at 12:24 PM.
C++ opens three streams when you start your program cin, cout, and cerr. The cerr stream is an unbuffered that is usually connected to the console and is usually used for error reporting.okay now i would like to ask you that what is the use of 'cerr' in C++??? it just clicked in my mind right now
It is not the use of the header file that you are actually having problems with, but the lack of the function implementations that this header defines. This graphics library only works with a Borland compiler. Are you using this ancient compiler? I hope not!and another one....why i am not able to use graphics.h header file?
No, not unless you're using that ancient compiler.is the code right ?
Also main() must be defined to return an int, not void. This is one of those bad habits you're talking about!
Jim
graphics.h - I knew that was coming - turbo C it had to be - why do programming students in India have to be so poorly served by thier tutors.
It won't work because it is very old - modern hardware is very unlikely to support it. And that is only one part of the compiler suite you are using - so how relevant do you think the rest will be?
Thought for the day:FLTK: "The most fun you can have with your clothes on.""Are you sure your sanity chip is fully screwed in sir?" (Kryten)
Stroustrup:
"If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"
A good way to learn about bad practice is to visit these pages regularly and follow the threads and advice given, you will soon see what is agreed to be good, bad, and debated about
Thought for the day:FLTK: "The most fun you can have with your clothes on.""Are you sure your sanity chip is fully screwed in sir?" (Kryten)
Stroustrup:
"If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"
thanks jim and i am using modern editor+compiler but i used borland C++ earlier when i started doing programming in C++
then how will i be able to do some drawing in C++???
@rogster i told my school teacher about the ancient version of C++ editor i.e. turbo C++ but she declined and said 'we used to do v.nice programming in it i hope you can also do!!!'