#include <iostream>
#include <string>
#include "spanishverbs.h"
#include <windows.h>
usingnamespace std;
void verbmenu ( );
void nounmenu ( );
void mainmenu ( )
{
system ( "cls" );
cout << tospeak;
string menu[4] = { "Verb Study and Quizzes", "Noun and Pronouns", "Sentences", "Exit" };
int pointer = 0;
while ( true )
{
system ( "cls" );
SetConsoleTextAttribute ( GetStdHandle ( STD_OUTPUT_HANDLE ) , 15 );
cout << "SPANISH STUDY and QUIZZES\n\n";
for ( int i = 0; i < 4; ++i )
{
if ( i == pointer )
SetConsoleTextAttribute ( GetStdHandle ( STD_OUTPUT_HANDLE ) , 11 );
else
SetConsoleTextAttribute ( GetStdHandle ( STD_OUTPUT_HANDLE ) , 15 );
cout << menu[i] << '\n';
}
while ( true )
{
if ( GetAsyncKeyState ( VK_UP ) )
{
if ( --pointer == -1 ) pointer = 3;
break;
}
elseif ( GetAsyncKeyState ( VK_DOWN ) )
{
if ( ++pointer == 4 )
{
pointer = 0;
Sleep ( 500 );
}
break;
}
elseif ( GetAsyncKeyState ( VK_RETURN ) )
{
switch ( pointer )
{
pointer = 0;
case 0:
verbmenu ( );
break;
case 1:
nounmenu ( );
break;
case 2:
break;
case 3:
break;
case 4:
break;
}
}
Sleep ( 500 );
}
}
}
void verbmenu ( )
{
int pointer = 0;
string menu[3] = { "Verb Study", "Verb Quizzes", "Exit" };
while ( true )
{
system ( "cls" );
SetConsoleTextAttribute ( GetStdHandle ( STD_OUTPUT_HANDLE ) , 15 );
cout<<"VERB MENU\n\n";
for ( int i = 0; i < 3; ++i )
{
if ( i == pointer )
SetConsoleTextAttribute ( GetStdHandle ( STD_OUTPUT_HANDLE ) , 11 );
else
SetConsoleTextAttribute ( GetStdHandle ( STD_OUTPUT_HANDLE ) , 15 );
cout << menu[i] << '\n';
}
while ( true )
{
if ( GetAsyncKeyState ( VK_UP ) )
{
if ( --pointer == -1 )
{
pointer = 2;
Sleep ( 500 );
}
break;
}
elseif ( GetAsyncKeyState ( VK_DOWN ) )
{
if ( ++pointer == 2 )
{
pointer = 0;
Sleep ( 500 );
}
break;
}
elseif ( GetAsyncKeyState ( VK_RETURN ) )
{
switch ( pointer )
{
pointer = 0;
case 0:
case 1:
cout << "hello " << pointer;
break;
case 2:
mainmenu ( );
break;
}
}
}
}
}
void nounmenu ( )
{
}
int main ( )
{
mainmenu ( );
}
Can you give us more information on the crash? Does it crash when it tries to run verbmenu(), or inside verbmenu()? What error message do you get?
Looks like Chervil found the problem.
You seem to have a lot of repeated code. You could probably combine some of it.