well, I'm using a book called "Learn C++ in 21 days" and it's working out great so far. The only problem is that when I type in the code from the book, letter for letter, many errors pop up. Is this book made for a previous version of C++? It was writtin at least 5 years ago, and the verion of C++ I'm using is "Dev-C++ v.5"...
Anyone know of this problem? Is there actually a problem with this code? Heres an example of the book's code
#include <iostream.h>
void myFunction();

int x = 5, y = 7;
int main()
{
cout << "x from main: " << x << "/n";
cout << "y from main: " << y << "/n/n";
myFunction();
cout << "Back from myFunction!/n/n";
cout << "x from main: " << x << "/n";
cout << "y from main: " << y << "/n";
return 0;
}

void myFunction()
{
int y = 10;

cout << "x from myFunction: " << x << "/n";
cout << "y from myFunction: " << y << "/n/n";
}

So, obviously it's just a simple little program, not really doing much, but it won't work!
Someone know how to fix my problem?

Also, one of the errors at the bottom of the page is "32:2 C:\Dev-Cpp\include\c++\3.4.2\backward\backward_warning.h #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated. "

heh, anyone know this one?

>Is this book made for a previous version of C++?
Yup.

>Anyone know of this problem?
iostream.h is deprecated, replace the #include line with this:

#include <iostream>
using namespace std;

Best to get a more current book.

do you have any book ideas? Any really good books for people who know . . . hmm, 1 100th of C++ :P

Thanks! I'll look into getting that. I have a another question :S

1. When I've compiled things (i looked in the examples, and wow! they look a lot different from my book so I really must be 'outa style'.), even things that I haven't written, I go to "execute" them, and a little window pops up saying "source file not compiled". Im so sorry if this is a total noob question, but I can't make heads or tails of it :)


EDIT: By the way, I've just read some other threads, and I really thank you guys for your useful knowledge and the way you apply it. Please tell me when I am stepping over the line of
What I need to learn for myself | and | What you could help me with
Thanks!

EDIT2: Joe, thanks for all you've done already. Much appreciated.

1. When I've compiled things (i looked in the examples, and wow! they look a lot different from my book so I really must be 'outa style'.), even things that I haven't written, I go to "execute" them, and a little window pops up saying "source file not compiled". Im so sorry if this is a total noob question, but I can't make heads or tails of it :)

Seems like a "rebuild all" should do it. Failing that, reinstall of Dev-C++?
http://forums.devshed.com/c-programming-42/bloodshed-dev-c--trouble-in-windows-vista-436263.html

EDIT: By the way, I've just read some other threads, and I really thank you guys for your useful knowledge and the way you apply it. Please tell me when I am stepping over the line of
What I need to learn for myself | and | What you could help me with
Thanks!

Don't worry about it too much. As long as you have a clear idea of what you need help with, there'll be no problems. Basically we get annoyed when people expect us to do their homework for them, without them showing any effort.

Something that you could have done however, is read the announcements at the top of this forum. One that you seem to have missed is the code tags rule.

Thanks!
1. I will look into that new book for me, "Accelerated C++". Thanks for recommending, by the way.
2. I restarted C++ and it was fine. Thanks anyways!
I think that this will be all on this thread, because I know where to go from here (trying out things from the new book). Thanks Joe for helping out.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.