"Unable to open include file 'iostream.h'"

Keane 16

New Member
Disciple
Feb 7, 2006
2,173
16
0
28
Hey guys, i'm new to C++, using Turbo C++, whenever i try to compile my prg, it gives me an error saying - ""Unable to open include file 'iostream.h'""

I've specified the directories correctly and the C++ installation is fine(worked on another comp) ....

What do i do ? :S ...

EDIT : haha ... lame mistake ... wrong drive in directory path ...

anyway, i still got one error -

#include<iostream.h>

#include<conio.h>

void main ();

{

clrscr();

float i,r,t,p,a;

cout<<"Welcome to the SI calculator. Press any key to continue...";

cin>>a;

cout<<"Please enter the Rate of interest per annum - "

cin>>r;

cout<<"Please enter the Principal - "

cin>>p;

cout<<"Please enter the Time in years - "

cin>>t;

i=p*r*t/100;

cout<<"The Simple Interest is "<<i;

getch;

}
 

KingKrool

New Member
Adept
Mar 16, 2005
3,556
71
0
Um??? Why is there a semicolon ";" in front of "void main()"??

It should read

void main()

{

.....

}
 

Keane 16

New Member
Disciple
Feb 7, 2006
2,173
16
0
28
tks dude. will post quite often in this forum now .... class 11 started ..
 

Keane 16

New Member
Disciple
Feb 7, 2006
2,173
16
0
28
thanks again mate ...

im gonna need u guys' help for the next 2 yrs .. :D

now it says statement missing in the bold line :

#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

float i,r,t,p,a;

cout<<"Welcome to the SI calculator. Press any key to continue...";

cin>>a;

cout<<"Please enter the Rate of interest per annum - ";

cin>>r;

cout<<"Please enter the Principal - ";

cin>>p;

cout<<"Please enter the Time in years - "

cin>>t;

i=p*r*t/100;

cout<<"The Simple Interest is "<<i;

getch();

}
 

Keane 16

New Member
Disciple
Feb 7, 2006
2,173
16
0
28
#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();
float i,r,t,p,a;
1. cout<<"Welcome to the SI calculator. Press any key to continue...";
cout<<"Please enter the Rate of interest per annum - ";
cin>>r;
cout<<"Please enter the Principal - ";
cin>>p;
cout<<"Please enter the Time in years - ";
cin>>t;
i=p*r*t/100;
2. cout<<"The Simple Interest is "<<i;<<". The amount is"<<p+i;
getch();
}

1. How do i make the prog work so that wen i press any key, it goes to the next cout ? /n ?

2. There's an error in this line ... it works without the amount line, but shows an error when i add the amount bit ...
 

KingKrool

New Member
Adept
Mar 16, 2005
3,556
71
0
To solve q1

cout<<"Welcome to the SI calculator. Press any key to continue...";

getch();

cout<<"Please enter the Rate of interest per annum - ";
 

Yamaraj

New Member
Adept
Aug 12, 2005
405
13
0
@OP,
Get yourself a decent book and an euqally decent compiler. Turbo C++ is dead, rotten and badly decomposed.
Here are a few suggestions:

1. C++ Primer Plus - Stephen Prata
2. The C++ Programming Language, 3rd Special Edition - Stroustrup
3. C++ : How to Program, 5th Ed. - Deitel & Deitel
4. Object Oriented Programming in C++, 4th Ed - Robert Lafore
5. C++ Primer, 3rd/4th Ed - Lippman

i. Microsoft Visual C++ 2005 Express Edition - free
ii. Microsoft Visual C++ 2003 ToolKit - free
iii. MinGW port of GCC (Windows), GCC (Linux, *BSD, *NIX) - free

And, clrscr() is NOT defined anyplace in the C or C++ Standard Library.
 

KingKrool

New Member
Adept
Mar 16, 2005
3,556
71
0
And, clrscr() is NOT defined anyplace in the C or C++ Standard Library.
Nor is getch()

For that matter, there is nothing standard about TC. But leave the guy alone. Is in 11th standard. If he needs it for school that is different. but if he wants to learn just for his own purposes, the I agree with you. He needs to switch, preferably to Microsoft VC++ (gcc is very difficult to use for a beginner).

And don't start him off on v3 of the standard. He is better off starting with the same old v1 (TC type).
 

Keane 16

New Member
Disciple
Feb 7, 2006
2,173
16
0
28
Well, does anyone here have GCC ? My friend(Bhaskar Kishore - creator of easySify) told me to use that ... Im only doing TC for skool ..
 

Yamaraj

New Member
Adept
Aug 12, 2005
405
13
0
KingKrool said:
Nor is getch()
Correct!
KingKrool said:
For that matter, there is nothing standard about TC. But leave the guy alone. Is in 11th standard. If he needs it for school that is different. but if he wants to learn just for his own purposes, the I agree with you. He needs to switch, preferably to Microsoft VC++ (gcc is very difficult to use for a beginner).

And don't start him off on v3 of the standard. He is better off starting with the same old v1 (TC type).
IMHO, it's not easy to un-learn bad programming style after having picked up early.
It's better for him, and others too, to learn the proper and standardized way
of programming from the very beginning, than having to discard old habits.

GCC isn't difficult. It's just that beginners get used to IDEs very early, which
badly affects their ability to understand and invoke the compilers and linkers
separately. IDEs should only be made available to professionals, not students.
 

Yamaraj

New Member
Adept
Aug 12, 2005
405
13
0
akshitmohan said:
Well, does anyone here have GCC ? My friend(Bhaskar Kishore - creator of easySify) told me to use that ... Im only doing TC for skool ..
http://www.mingw.org
Yesterday, I built myself a MinGW port of the latest GCC-4.1 (C,C++ only). I've
also compiled the latest CVS repository of Emacs for Windows using this new
release. Get the NTEmacs from: http://ntemacs.sourceforge.net

If I get enough requests, I may upload the GCC-4.1 toolchain, custom built for
myself, someplace for the benefit of everyone.

7zipped archive would come around 12MB, I guess.