My query is this. I've had to make a few changes to the examples given in the book to make it compile and I'm just trying to find out why this is, the book was published in 1994 so I'm wondering has C++ changed somewhat since then, is it the compiler I am using, or is it to do with Windows itself?
Anyhoo, one of the code examples in the book is:
#include <iostream.h>
main()
{
int gallons, litres;
cout << "Enter the number of gallons: ";
cin >> gallons; // takes an input from the user
litres = gallons * 4; // convert to litres
cout << "Litres: " << litres;
return 0;
}
#include <iostream> // as opposed to iostream.h
using namespace std; // this has been added
int main() // else reports back with error
{
int gallons, litres;
cout << "Enter the number of gallons: ";
cin >> gallons; // takes an input from the user
litres = gallons * 4; // convert to litres
cout << "Litres: " << litres;
return 0;
}


Comment