L
L
liquidplus2014-02-09 18:11:41
C++ / C#
liquidplus, 2014-02-09 18:11:41

Entering NULL value in C++?

There is a program that uses std::cin >> variable;.
Why doesn't the program continue when I don't enter anything? I want to get a NULL value, but the function prompts me to enter further.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
N
Nikita Gusakov, 2014-02-09
@hell0w0rd

because when you press enter, you type \n, which is also just a character, and it is skipped. NULL is \0.
I don’t really know what to use, I understand that you need to interfere with work with streams, for example, use cin.get()

Z
ZloyHobbit, 2014-02-09
@ZloyHobbit

www.cplusplus.com/forum/articles/6046

T
Teivaz, 2014-02-16
@Teivaz

getch()

A
Alexey Gorshkov, 2014-02-17
@agorshkov23

Because the program waits for a string to be entered and RETURN to be pressed .
You can use the GetKeyState function to determine which keyboard button is currently pressed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question