#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 :)
Help! Where is the error?? :(
Hi Guys! I'm trying to make a 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:
I put #include <iostream> and it doesn't recognize "cout" and "cin".
I'm using DevC++ 4.9.9.2
Moderators, can you delete this post? i don't know why i posted twice this thread. The other one is written better with Source tags.
Thank u!
[Edited by - GutyGu on June 6, 2006 2:30:45 PM]
I'm using DevC++ 4.9.9.2
Moderators, can you delete this post? i don't know why i posted twice this thread. The other one is written better with Source tags.
Thank u!
[Edited by - GutyGu on June 6, 2006 2:30:45 PM]
try std::cout, std::endl and std::cin
or
"using namespace std;" before you use cin and cout
like the previous poster said, it should also be #include <iostream>
or
"using namespace std;" before you use cin and cout
like the previous poster said, it should also be #include <iostream>
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement