C++/New, and confused,
Im in the process of learning c++ from a book i have, Im using Dev-c++ 4.9.9. Win xp pro
1. Whats the deal with, #include <iostream.h> It dont work, it only worlks if i do #include <iostream>, and then put using namespace std;
2.I have seen this written several times clrscr();, i assume it clears the screen, but it doesnt work, i get the error 'clrscr' undeclared (first use this function)
3. And finally. This is really bothering me, i get some programs off the web, its helps me learn, but i see, always people use void, indtead of int for the main function, like this
the book says to use int main(), and also, sometimes in the braces to put ( int argc, char *argv) argc.
I dont get it, when i try to compile using the void methode, i get the error 'main' must return int.
I am very troubled, i got all these programs from reliable sources, maybe i am confusing something with the old c language, i dont kno;w, but the progs should work, and they just dont, i have to always change th code around,
I have also tried to compile with gcc g++, same thing.
Thanks, for all you help, i appreciate it a lot.
samantha , Thank you for your question.
C++ was designed by a committee. This in itself is not necessarily a problem, but there were several versions of C++ in actual use while it was designed. There are several decisions that the Standards committee made that differ with assumptions made by some of the compiler vendors. Most of these involve tightened requirements.
1. The issue of the std namespace has been discussed in C++ forums. For example, see http://forums.devshed.com/showthread.php?p=253794
. Always consider searching the Web when you encounter a programming problem.
2. Neither C++ nor the C++ run time library includes any support for graphics programming. A Google search for "clrscr" turns up that this is a nonstandard function that clears the screen by sending an "escape code". Such a function depends on the system having terminal emulator software. Digital Equipment Corporation VT-series terminals could be cleared by sending the Esc character code followed by another keycode.
3. The usage "void main(...)" is simply incorrect. Some compilers may accept this; some may not. If you have an example that declares 'main' incorrectly, simply correct it.
You say you are "very troubled", and "This is really bothering me". I sympathize with your frustration. Although it may not seem to be so, there are solutions to all the problems that you have and will encounter with C++. A little patience and a little Web searching will ease your mind.
If you have further questions, please do not hesitate to ask.