>i just want to whether there is a replacement for getch() in C++.
There isn't a standard equivalent for getch in either C or C++.
>my friend said getch() is C function.
No, getch is a compiler extension. You can use it in either C or C++ if your compiler supports it, but for the most part you don't need to.
For what purpose were you intending to use getch? The most common by far is keeping a console window from closing when you run the program from a Windows IDE:
#include <conio.h>
int main()
{
// Your program here
getch();
}
That's not a recommended solution, and most experienced programmers will recommend that you use cin.get:
#include <iostream>
int main()
{
// Your program here
std::cin.get();
}
I'm here to prove you wrong.