You are here:

C++/New, and confused

Advertisement


Question
Hi,
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
void main()

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.  

Answer
hi!

Actually <iostream.h> ans clrscr() works with the old c++ compilers. They were extensively used with C like programming.ususlly suppoted by Turbo C 3.0 etc
and the new complilers like Borland5.0 ( although it is qiute old version now ) doesnot support it.

name space std etc... They are the pure C++ statements supported by the new Compilers.


I hope this could help.

regards
professional.  

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Professional

Expertise

I can answer any question about functions,pointers,structures,object oriented programming basics of classes and data structures.My strong field is structured programming.

Experience

I have got 2 years experiece under C . I am able to answer about the structured concepts pointers to a little extent,OOP concepts. I have also experience in data Strucutres like Linked List, Stacks , Queues, Heaps, B Trees, Red Black Trees. I will try to satisfy with my knowledge. I am the Student of an expert here Martin, what i have learnt today, i just owe my every knowledge to him. He is the greatest.

©2016 About.com. All rights reserved.