Did your compiler tell you why you couldn't?
3 things you should do in your C++ programs:
1) do not use the .h after iostream - it's depricated.
2) main is an int, not a void, and you need a return type (standard is 0) at the end of the program.
3) Specify/declare your namespace. For beginners, 'using namespace std;' will suffice after your library declarations.
Your compiler might be complaining about these things, mine certainly allowed your code to compile and execute after I changed these things.