iostream.h

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,

i have copied some c++ code from a book. here it is:

#include <iostream.h>
int Add (int x, int y)
{
cout << "In Add(), received " << x << " and " << y << "\n";
return (x+y);
}

int main()
{
cout << "I'm in main()!\n";
int a, b, c;
cout << "Enter 2 numbers: ";
cin >> a;
cin >> b
cout << "\nCalling Add()\n";
c=Add(a,b);
cout << "\nBack in main().\n";
cout << "c was set to " << c;
cout << "\nExciting\n\n";
return 0;
}

i keep getting an error, though: "fatal error C1083: Cannot open include
file "iostream.h". no such file ot directory exists"

what do i do to get rid of this error? do i set the using precompiled
headers property to use precomplied headers?
 
Throw away the book, and find a newer one.

#include <iostream>
using namespace std;
 
you should use "#include<iostream>" instead of "#include<iostream.h>", if
you use VS.NET. besides this, your project is very simple which means you
didn't use STL, MFC or .NET, so you can build up a empty project (under
..NET ) and add a .cpp file.
 
Back
Top