Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

How do i retrieve the key input without std::cin in c++?

+1 vote
asked Jan 13, 2023 by human (250 points)
I want to use getch but idk how

and i dont want to use std::cin

and this is in c++

2 Answers

0 votes
answered Jan 14, 2023 by Peter Minarik (84,720 points)

Only platform-dependent solutitons exist.

Check this thread for more details on how to do it on Windows and Linux.

0 votes
answered Jan 14, 2023 by Narek (140 points)
// Example program
#include <iostream>
#include <string>

int main()

int a;

getch >>a;

cout <<a;
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...