C++/New to c++,
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.
Please do not use "iostream.h". Use "iostream" and then put "using namespace std". As you know that cout,cin etc are declared and defined in that namespace. Namespace concept in C++ (or any other langauge like package in Java and Perl) make us safe in the sense that we can have functions/variables of the same name in different modules (if they are in different name space).
For clrscr(), please try to find the header file where it is declared or you can say extern void clrscr() on the top of your file :--).
The days of main having void return has long gone so please stick to int :--)