VS2010 iostream not found

Hi guys,

I am very new to C++, but not new to programming (have used VBA for a number of years)

I have downloaded a copy of Microsoft Visual Studio 2010 Express.

I am trying to compile some code from a book I am reading ("Introduction to C++ for Financial Engineers")

Here is my code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "Inequalities.h"
#include <iostream>
using namespace std;

int main()
{
	// Prompt the user for input.  Console output (cout) and input (cin)
	double d1, d2;
	cout << "Give the first number: ";
	cin >> d1;
	cout << "Give the second number: ";
	cin >> d2;

	char c;		// Character type
	cout << "Which function a) Max() or b) Min()? ";
	cin >> c;
	if (c == "a")
	{
		cout << "Max value is:" << Max(d1, d2) << endl;
	}
	else
	{
		cout << "Min value is: " << Min(d1, d2) << endl;
	}
	double dA = 1.0; double dB = 2.0; double dC = 3.0;
	cout << "\ n\ nMax and min of three numbers: " << endl;
	cout << "Max value is: " << Max(dA, dB, dC) << endl;
	cout << "Min value is: " << Min(dA, dB, dC) << endl;

	return 0;
}


When I hover over the "#include" to the left of "<iostream>" I get the following:

Error: cannot open source file "iostream"

In addition to this, when I hover over the "std;" to the right of "using namespace" I get the following:

Error: name must be a namespace name

I can't help but think that I need to enable a library somewhere because, from what I have read, iostream and namespace std are fairly standard libraries... correct?

I appreciate any and all help you can give me. If you need any additional information just ask and I will do my best to give you it.

Thanks

Chris
That should work perfectly from the second you install MVC++2010...

Did you start the correct type of project? (General -> Empty project)

If that's not it, I'm at a loss. Try reinstalling.

(One code-note: If comparing a char to a literal, I think you need to use ' ' instead of " ". " " is for strings.)
Last edited on
Thanks for the reply.

I tried re-installing and it seems to have fixed the problem.

Thanks
Topic archived. No new replies allowed.