How To Clear The Input Buffer | C++ Tutorial

How To Clear The Input Buffer | C++ Tutorial

Portfolio Courses

2 года назад

21,074 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

AMINE
AMINE - 23.10.2023 22:52

thank you ! i finished the program and the get line function worked only for one time and i thought i had to start all over again but hey it is all that buffer thing ,so all i have to do is the ignore function just befor the get line to ensure that the buffer is empty right?

Ответить
Micheal John
Micheal John - 05.10.2023 02:14

That's really so useful, thank you !

Ответить
ANKIT SHAW_ 30
ANKIT SHAW_ 30 - 18.09.2023 20:47

Instead of writing cin.ignore ig we can use a dummy getline also to clear the buffer like
cin>>number;
string temp;
getline(cin,temp); //dummy getline
char s[256];
//then take your input

Ответить
Tushi Kushi
Tushi Kushi - 13.05.2023 19:24

Superb explanation

Ответить
Alonso Pérez
Alonso Pérez - 08.04.2023 00:21

Hello!!! Nice video sir explainning a difficult concept like clear the buffer, but I have a qusetion, I'm using Netbeans for windows, and when I use the cin.ignore(1,'\n'), my program can delete 1 skip even if I just put 1 for ignore the '\n'. I whant to know if thi is because we areusing differents IDE's or it's because something else.

Ответить
ADRIAN MURILLO
ADRIAN MURILLO - 03.03.2023 03:48

numeric_limits<streamsize>::max()

das goated, thanks g

Ответить
Firepower
Firepower - 17.02.2023 21:19

C and C++ legend over here

Ответить
Said Rafili
Said Rafili - 27.01.2023 14:10

Awesome explanation as usual. Thank you, Sir. Please, make more videos on interesting topics in C++

Ответить
Braz Amorim
Braz Amorim - 21.01.2023 22:26

Nice explanation!

Ответить
lf
lf - 02.01.2023 23:43

There is another solution that's a bit easier. You can do the following instead:
number = _getch();
include the <conio.h> library.


But thanks for the info. I didn't know you could this it like this too.

Ответить
Hafiz Sakib
Hafiz Sakib - 23.11.2022 10:37

Nice explanation

Ответить
Aniruddha Mukherjee
Aniruddha Mukherjee - 24.10.2022 13:24

I love how you make each and every video stand on its own feet, in the sense that the viewer has to never refer to a previous video to get hold of the topic being taught. Thank you for going the extra mile making each tutorial self-reliant!

Ответить
YamaiKaguya
YamaiKaguya - 07.10.2022 18:12

Thanks again👌

Ответить
Yuw Ownly
Yuw Ownly - 27.08.2022 17:02

Great video Sir. Your channel really helps me a lot in learning programming especially c++. But I have one question sir. Do you have any resources on how I can deeply understand buffers in c++ and how it works?

Ответить
Kunal Bahirat
Kunal Bahirat - 24.08.2022 06:57

Thanks it was helpful!

Ответить
qqqqpppp$
qqqqpppp$ - 02.07.2022 11:19

thank you sir

Ответить
Tanmay Goyal
Tanmay Goyal - 20.06.2022 16:37

Thanks for this. On point, intelligent explanation.

Ответить
Paolo Flores ඞ
Paolo Flores ඞ - 19.06.2022 01:50

Nice, clear and concise explanation

Ответить
xin king
xin king - 08.06.2022 13:43

good explain! thank you

Ответить
ZoXeMo
ZoXeMo - 04.04.2022 17:58

👍👍👍

Ответить