How to translate this code from turbo pascal to c++?
1 2 3 4 5 6 7 8 9 10
writeln('Would you like to exit? [Y]es or [N]o?');
choice:=readkey;
if (choice='N') or (choice='n') then
begin
goto 1;
end;
elseif (choice'Y') or (choice='y') then
begin
halt;
end;
I know getch() reads a key but i dont know how to use it. Please help me.
But remember that getch() is not standard, therefore it may not be available. A better atlernative, since the OP stated C++ would be to use something like: