Okay so I'm trying to learn the basics of C++ from a book which is I think, well I know, a few years old. I already came across a couple of problems;
Firstly the <iosteam.h> thing, which can technically be rectified by using -wno- deprecated in my djgpp compiler, but i read online a bit and saw people saying "just use <iostream>" which didin't work until I added, the 'using namespace std' sub header. I wondered if anyone could tell me what 'using namespace std;' means and whether using that with taking the .h off the iostream is like a straight swap as it were, so far it has served me well, but I can imagine I could run into problems if, in my book its telling me to use other .h headers or something, and just putting 'using namespace std;' wont cut it anymore. (Yes I am a complete and utter novice sorry).
Problem I have now, could even be related to the problem above, I've copied everything word for word (apart from <iostream.h>), and I'm getting an error message, and I've hit a wall where I literally don't know what to do to rectify it, here is the code and the error message, I have put the error message actually in the code next to the lines the compiler has problems with, it's on line 26 and 27 I think, you shouldn't miss it. I hope someone can help!!!!! Thanks in advance :D Paul.
[
/*enum.cpp 22/06/2008 enumerated types demo**/
#include <iostream>
using namespace std;
//delcare a new enumerated type 'days'
enum days
{
Saturday,//Saturday = 0 by default
Sunday = 0,//force sunday to be 0, default would be 1
Monday,//monday now 1, and each following day +1
Tuesday,
Wednesday,
Thursday,
Friday
} today;//declare a new variable 'today' of type 'days'
int main()
{
//declare two more 'days' objects
days yesterday, tomorrow;
//assign some values and print
today = Tuesday;
yesterday = today-1;//**Here's the error 'Invalid conversion from 'int' to 'days' '
tomorrow = today+1;//**And this line too 'Invalid conversion from 'int' to 'days' '
cout<<"\nToday is "<<today;
cout<<"\nYesterday was "<<yesterday;
cout<<"\nTomorrow will be "<<tomorrow;
return 0;
}
]