Hello daniweb, I've been trying to impliment arrow keys into my program, I've found a way, but the problem is I cant figure out how to use the enter key to select an option as follows:
pawns:
int pawn;
system("cls");
pawndd:
gotoxy(0,0);
SetConsoleTextAttribute(hColor,455);
cout<<" RETURN TO PREVIOUS MENU";
SetConsoleTextAttribute(hColor,23);
cout<<"\n";
cout<<" INTEREST CALCULATOR";
cout<<"\n";
cout<<" RENEW, EXTEND, OR REDEEM";
//cin>>pawn;
kbmain=_getch();
/*if(kbmain!='\0')
{
kbmain=_getch();
}
*/
kbmain=getch();
if(kbmain == 'H')
{
goto hrer;
}
if(kbmain == 'P')
{
hintcalc:
gotoxy(0,0);
cout<<" RETURN TO PREVIOUS MENU";
cout<<"\n";
SetConsoleTextAttribute(hColor,455);
cout<<" INTEREST CALCULATOR";
SetConsoleTextAttribute(hColor,23);
cout<<"\n RENEW, EXTEND, OR REDEEM";
cout<<"\n";
}
kbmain2=_getch();
if(kbmain2!='\0')
{
kbmain2=_getch();
}
if(kbmain2 == 'H')
{
goto pawndd;
}
if(kbmain2=='P')
{
hrer:
gotoxy(0,0);
cout<<" RETURN TO PREVIOUS MENU";
cout<<"\n";
SetConsoleTextAttribute(hColor,23);
cout<<" INTEREST CALCULATOR";
SetConsoleTextAttribute(hColor,455);
cout<<"\n";
gotoxy(0,2);
cout<<" RENEW, EXTEND, OR REDEEM";
SetConsoleTextAttribute(hColor,23);
}
kbmain3=_getch();
if(kbmain3!='\0')
{
kbmain3=_getch();
}
if(kbmain3=='H')
{
goto hintcalc;
}
if(kbmain3=='P')
{
goto pawndd;
}
if(pawn == 3)
{
string p1;
string p2;
string p3;
string p4;
string p5;
string p6;
string p7;
string p8;
string p9;
string p10;
string p11;
string p12;
string p13;
string p14;
string p15;
string p16;
string p17;
string p18;
float extend;
float renew;
float redeem;
char getloan[6];
string err;
system("cls");
cout<<"Enter The Pawn # To Open: ";
cin>>getloan;
ifstream pay (getloan);
{
getline(pay, p1);
getline(pay, p2);
getline(pay, p3);
getline(pay, p4);
getline(pay, p5);
getline(pay, p6);
getline(pay, p7);
getline(pay, p8);
getline(pay, p9);
getline(pay, p10);
getline(pay, p11);
getline(pay, p12);
getline(pay, p13);
getline(pay, p14);
getline(pay, p15);
getline(pay, p16);
getline(pay, p17);
getline(pay, p18);
}
cout<<p1<<p2<<p3<<endl;
cout<<p4<<endl;
cout<<p5<<endl;
cout<<p6<<endl;
cout<<p7<<endl;
cout<<p8<<endl;
cout<<p8<<endl;
cout<<p9<<endl;
cout<<p10<<endl;
cout<<p11<<endl;
cout<<p12<<endl;
cout<<p13<<endl;
cout<<p14<<endl;
cout<<p15<<endl;
cout<<p16<<endl;
cout<<p17<<endl;
cout<<p18<<endl;
cout<<"1.Extend 2.Renew 3.Redeem";
cin>>err;
if(err == "1");
{
cout<<"Extension Amount: $15.00";
cout<<"\n\nAmount To Collect NOW ->";
cin>>extend;
cout<<"Processing. . . ";
Sleep(250);
goto extras;
}
system("cls");
goto extras;
}
if(pawn == 2)
{
intcalc:
float borrowed;
int apr;
int years;
float interest;
system("cls");
cout<<"ENTER AMOUNT BORROWED $";
cin>>borrowed;
if(borrowed > 499.99)
{
pwd_ent:
system("cls");
int temp_c=rand()%99999;
int temp_k;
int temp_p;
cout<<"ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"<<endl;
cout<<"ÛÛ Û Password Required Û ÛÛ"<<endl;
cout<<"ÛÛ ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ÛÛ"<<endl;
cout<<"ÛÛ ÛÛ"<<endl;
cout<<"ÛÛ ÛÛ"<<endl;
cout<<"ÛÛ Loan Between $500.00 and $1240.00 ÛÛ"<<endl;
cout<<"ÛÛ ÛÛ"<<endl;
cout<<"ÛÛ ÛÛ"<<endl;
cout<<"ÛÛ ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ÛÛ"<<endl;
cout<<"ÛÛ ÛÛ Temporary Code "<<temp_c<<" ÛÛ ÛÛ"<<endl;
cout<<"ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"<<endl;
temp_k = temp_c + 22222;
cout<<"Enter Password. . . ";
cin>>temp_p;
if(temp_p == temp_k)
{
goto ap;
}
else {
system("cls");
goto pwd_ent;
}
}
else{
goto ap;
}
ap:
cout<<"ENTER APR %: ";
cin>>apr;
apr = apr / 100;
cout<<"ENTER TIME IN YEARS: ";
cin>>years;
interest = borrowed * apr * years;
cout<<"INTEREST = "<<interest<<endl;
system("pause");
goto pawns;
}
if(pawn == 1);
{
system("cls");
goto extras;
}
}
}
Please help me find a way to use enter to select an option.