Do I need to use cin.get()

Our lecturer at Uni said we should use cin.get() after every using of cin, so that the newline char isn't left in the buffer. However I wrote the following code without using it, and it works fine. Am I misunderstanding him?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>

using namespace std;

void product(int, int, int);

int main()
{
	int a, b, c;
	
	cout << "Enter 1st: ";
	cin >> a;
	cout << "Enter 2nd: ";
	cin >> b;
	cout << "Enter 3rd: ";
	cin >> c;
	
	product(a, b, c);
	
	return 0;
}

void product(int x, int y, int z)
{
	cout << endl << "Product is: " << x * y * z << endl;
}
Topic archived. No new replies allowed.