How to read a key in c++? I learned it in turbo pascal how to translate in c++?

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;
else if (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.
1
2
int choice = getch();
// use choice 
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:
1
2
char choice;
cin >> choice;
Topic archived. No new replies allowed.