   Help! Where is the error?? :(
  Hi Guys! I'm reading chapter 7 from "Teach C++ in 21 days". I'm trying to the little program with a menu using a for (;;) loop. When I compile it, it says:_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. _32:2 C:\Dev-Cpp\include\c++\3.4.2\backward\backward_warning.h Permission denied _32:2 C:\Dev-Cpp\include\c++\3.4.2\backward\backward_warning.h ld returned 1 exit status The first line appears everytime i compile a program.. but it compiles anyway without problems. The last two lines don't let me compile it now. Which is the error here?Here is the code:#include <iostream.h>enum BOOL { FALSE, TRUE };typedef unsigned short int USHORT;USHORT Menu();void DoTaskOne();void DoOtherTasks(USHORT opcion);int main(){    BOOL exit = FALSE;   for (;;)    {   USHORT opcion = Menu();   switch(opcion)   {  case (1): DoTaskOne(); break;  case (2): DoOtherTasks(2); break;  case (3): DoOtherTasks(3); break;  case (4): break;  case (5): exit = TRUE; break;  default: cout << "Por favor, ingrese una opcion correcta." << endl; break;   }  if (exit)  break;   }    return 0;}USHORT Menu(){    int opcion;   cout << "*------Menu------*" << endl;    cout << "Opcion (1)" << endl;    cout << "Opcion (2)" << endl;    cout << "Opcion (3)" << endl;    cout << "Opcion (4)" << endl;    cout << "Opcion (5)" << endl;    cout << endl;    cout << "Que opcion elige?: ";    cin >> opcion;   return opcion;}void DoTaskOne(){    cout << "Elegiste la opcion uno!!" << endl;}void DoOtherTasks(USHORT opcion){    if (opcion == 2)   cout << "Elegiste la opcion dos!!" << endl;    else   cout << "Elegiste la opcion tres!!" << endl;}Thank u all :)   
  As I said in the other thread, use #include <iostream> instead of <iostream.h>.  (Be careful to not start two threads with the same question.  You can just use the edit button if you need to change a post)   ;  Yes. I pressed SUBMIT button without seeing the preview.. so i pressed SHOW PREVIEW before it loads next page. And then I submit the new one. I think that's why it posted twice :( I apologize for this.Thank u for the answer. It doesn't work with <iostream>.. should i configure some option for that?   ;  I don't know if this is the thread you want me to reply to, but as someone mentioned in the other thread, you need to change "<iostream.h>" to "<iostream>", and then you should either replace all cout, cin and endl with std::cout, std::cin and std::endl, or declare that you are using the standard namespace std.it is probably the easiest to just put "using namespace std;" right after you include <iostream>.The only other error I can see is that you never seem to define BOOL (although this might be pre-defined on windows or something, I don't know).EDIT: Now I see that you actually DID define it. Sorry about thatHope that helped ;)[Edited by - moussen15 on June 6, 2006 11:36:55 AM];  Thank u! First warning has left the game :P haha. But.. the last two warnings are still there. What's strange here is that before I put "<< endl;" after "Has elegido la opcion uno" and "Has elegido la opcion dos" on DoTaskOne() and DoOtherTasks() functions.. it compiled and worked fine! but after I put that code it doesn't work anymore.I think this day 06/06/06 makes Dev-C++ go crazy.. hahahaThank u 4 all :)   ;Quote:Original post by GutyGuThank u! First warning has left the game :P haha. But.. the last two warnings are still there. What's strange here is that before I put "<< endl;" after "Has elegido la opcion uno" and "Has elegido la opcion dos" on DoTaskOne() and DoOtherTasks() functions.. it compiled and worked fine! but after I put that code it doesn't work anymore.I think this day 06/06/06 makes Dev-C++ go crazy.. hahahaThank u 4 all :)Are you sure those warnings occurred just when you added that code? I just tried compiling it on my Linux machine and it worked without any errors at all.Otherwise would advice you to check if that file "backward_warning.h" hasn't been damaged/removed or something because that is the only thing I can think of. I have never seen that message before :/   ;  I know this will sound strange but.. i didn't modify anything at all. I just pressed "COMPILE" again and it WORKED :SThis computer needs an exorcism.. haha.Thank u 4 your help! :)   ;Quote:Original post by GutyGuHi Guys! I'm reading chapter 7 from "Teach C++ in 21 days".Please don't. You would be better off to burn the book and get an up-to-date reference instead.- As mentioned, it's iostream with no .h now.- C++ has a real "bool" type. You should be using it.- The construct "for(;;)" is pretty silly. Understanding that it does the same thing as "while(true)" is useful to the extent that any kind of understanding is useful, but you should write constructs that express their intent.- Speaking of which, it's obvious that the value of the 'exit' flag is what you want to use to exit the loop, and you check it at the bottom of the loop. Thus, that flag is what you should be using for your while-condition.- The given code divides the tasks up in a rather arbitrary way. This is the sort of thing you expect in toy examples anyway, but you should not get into that kind of habit.- You don't need to, and I would argue you normally shouldn't, assign a function call to a temporary just to use the result right away. The exception is if you're going to use the result *more than once*, or in order to break up a complex expression. Generally, C++ constructs work with *expressions*, not just variables.- I recommend re-ordering your functions the other way around, i.e. implementing a function ahead of its first use, so that you can avoid writing the forward declarations. You save typing, and also highlight circular dependencies (since you will *have* to forward-declare for those, using forward-declarations *only* where they are needed gives you more information).- You don't need parentheses for the values of case statements.- You can generate the menu programmatically, to avoid copy-and-paste work or spelling errors. The computer should be made to do the work for you, in general, whereever possible.#include <iostream>using namespace std;typedef unsigned short int USHORT;USHORT Menu() {   cout << "*------Menu------*" << endl;    for (int i = 0; i < 5; ++i) { cout << "Opcion (" << i + 1 << ")\n";    }    cout << "\nQue opcion elige?: " << flush;    int opcion;    cin >> opcion;   return opcion;}// You shouldn't mix and match the control scheme like this, unless// the real "task 1" is quite different from "task 2" and "task 3" but// those two tasks have similarities (and can reuse part of the code path).// I left it alone because the other principles I mentioned are more important// for now...void DoTaskOne() {    cout << "Elegiste la opcion uno!!" << endl;}void DoOtherTasks(USHORT opcion) {    if (opcion == 2)   cout << "Elegiste la opcion dos!!" << endl;    else   cout << "Elegiste la opcion tres!!" << endl;}int main() {    bool exit = false;    while (!exit) {   switch(Menu()) {  case 1: DoTaskOne(); break;  case 2: DoOtherTasks(2); break;  case 3: DoOtherTasks(3); break;  case 4: break;  case 5: exit = true; break;  default: cout << "Por favor, ingrese una opcion correcta." << endl; break;   }    }};  Oooops.. I think i'm following the bad way :( . I've chosen that book because it's really easy to understand it. And I don't have money to buy one. Here books are veeery expensive. Are there any site with an up-to-date tutorial or something similar? i know GameDev have a lot of tutorials but i need a complete one which teach me step by step what i have to do.Thank you so much for your post. I'm going to follow your advices. I'm searching for sites with c++ tutorials. I hope to be programming in the right way soon.Good luck!   