It sounds like your getting confused with how you create c++ programs. You need to use a compiler to compile the code you have written into a workable .exe. Post what you have done and we'll help you get ont he right path because it sounds like you're just typing commands into cmd.
ok, listen. Download Dev-C++ (http://www.bloodshed.net/devcpp.html) (I think that's a good compiler). install if needed, I don't know, I use another compiler. Then, open Dev-C++ and open a new file. write in the "main.cpp" this code:
Hy!
Is the source code containing: #include<conio.h>
clrscr()
getch()
void main()
#include<iostream.h>
?
Then you should change the book you are using.It's an old book.
Here are some pointers:
- don't use #include<conio.h> , it's not from the C++ standard library
- clrscr() and getch() are from conio.h so they are not available as well.Don't use them.
- always include the header files from the standard C++ library, such as iostream, string, etc.
without the .h extension.So the right way to do it is: #include<iostream> not iostream.h
- main is always an integer function, so the right way to do it is: int main()
- if the compiler tells you it doesn't know what cout is, or other keywords that are
clearly from the C++ library, then either put std::before those keywords everytime,
or just put usingnamespace std; before the main() function.