B
berkay
#include <iostream>
using namespace std;
int main () {
streamsize size;
char ch;
streambuf * pbuf;
pbuf = cin.rdbuf();
cout << "Please enter some characters: ";
cin >> ch;
size = pbuf->in_avail();
cout << "The first character you entered is: " << ch << endl;
cout << size << " additional characters in input buffer" << endl;
return 0;
}
i enter ball;the output is:
The first character you entered is:b
4 additional characters in input buffer.
i think it must print 3 add.chars
using namespace std;
int main () {
streamsize size;
char ch;
streambuf * pbuf;
pbuf = cin.rdbuf();
cout << "Please enter some characters: ";
cin >> ch;
size = pbuf->in_avail();
cout << "The first character you entered is: " << ch << endl;
cout << size << " additional characters in input buffer" << endl;
return 0;
}
i enter ball;the output is:
The first character you entered is:b
4 additional characters in input buffer.
i think it must print 3 add.chars