new to C++.. a lot of errors on programs

I am 100% new to C++. taking it for a class in college, and we were given some homework assignments to do..

mind you i am not familair at all with unique terms and what not for this but i am learning, I have a large interest in C++ but i am still really new

i downloaded the Microsoft visual C++ 2010 express online

and it seems none of the programs are working..

for example.. i typed in the SAME EXACT program in the book, and it didnt work, a lot of errors, like undeclared identifiers for cout, endl..syntax errors, 'else'. 'return'..

and my friend in class did the same thing and his worked for him.. identical code..

could it be a download problem? maybe a setting off?

also, he suggesting saving the work to my E drive while the c++ program is on C drive?


The program you typed in from the book, did it start with #include "stdafx.h" ? That's a compiled header that most MS C++ Visual Studio programs need. If not, add it to the top of the include list, ( it must be the first one), and see if the program works for you. Your friend was probably using a different compiler, which doesn't use it.
I tried what you did, and an error came up for the title you posted...

in the book "a first book of C++" which had the problem.. by gary bronson..

it started with #include < Iostream.h>
int main ()

but the .h doesnt work for any program i try..

and i also added
using namespace std;

and i saved it to my E drive and the program worked..the cout or anything were not an issue.

why is this?

and of course when i type in my solution.. the black box disappears quickly.

It seems to me, that, that is an older book. The fourth edition, from 2011, shows just #include < iostream> Most of the newer includes don't need the .h, so try removing them in the source file. #include < Iostream.h> becomes #include < iostream> and so on.
yes it was an older book, and the .h always confused me but now i was able to get everything working properly, thank you for the help
Topic archived. No new replies allowed.