Add value in cin question

Im new in programming... How to add to variable new value in cin?

1
2
3
  int num;
  num=5;
  cin >> num;


If I would enter 2, variable "num" value would be 2. I want to add new value to older, not to assign new. So variable value should be 7 (5+2). How can I make it?
1
2
3
4
   int sum = 5 ;
   int input ;
   cin >> input ;
   sum += input ;
Topic archived. No new replies allowed.