Hola!

Registrándote como bakuno podrás publicar, compartir y comunicarte en privado con otros bakuos :D

Regístrame ya!

Dudas con CodeBlock y C++

Gogorense

Becerro
Desde
3 May 2012
Mensajes
15
Mi duda es porque no manda llamar los modulos en este menú, lo hice en c++ y con codeblocks, ayudenme porfavor, Gracias.

#include<windows.h>
#include<conio.h>
#include<iostream>
using namespace std;

typedef unsigned short USHORT;
HANDLE g_handle;

void SetPos(USHORT,USHORT);
void suma();
void resta();
int opc();

int main(int argc, char* argv[])
{
int opcion;
opcion=opc();
switch(opcion)
{
case 5: suma(); break;
case 8: resta(); break;
case 11: exit (0);
}
return 0;
}

int opc()
{
int y=5, m;
g_handle = GetStdHandle(STD_OUTPUT_HANDLE);
SetPos(8,y);
cout<<"->";
SetPos(10,5);
cout<< "Suma";
SetPos(10,8);
cout<< "Resta";
SetPos(10,11);
cout<<"Salir";
do
{
m=getch();
switch(m)
{
case 72:
SetPos(8,y);
cout<<" ";
y-=3;
if(y<5)
y=11;
SetPos(8,y);
cout<<"->";
break;
case 80:
SetPos(8,y);
cout<<" ";
y+=3;
if(y>11)
y=5;
SetPos(8,y);
cout<<"->";
break;
}
}
while(m!=11);
return y;
CloseHandle(g_handle);
}

void SetPos(USHORT x,USHORT y)
{
COORD cp = {x,y};
SetConsoleCursorPosition(g_handle,cp);
}

void suma()
{
cout<<"La suma es 5";
}

void resta()
{
cout<<"La resta es 0";
}
 
Volver
Arriba