Advertisement
The_KGB

C++ Add 10 to a number with function

Dec 29th, 2013
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. void addten(int); //function prototype
  5. int main(){
  6.     cout << "Program that takes a number and adds 10 using functions. \n\n";
  7.     cout << "Enter a whole number: ";
  8.     int number;
  9.     cin >> number;
  10.     cout << "\n";
  11.     addten(number);
  12.     return 0;
  13. }
  14.  
  15. void addten(int n){
  16.     n = n + 10;
  17.     cout << "Number plus 10: " << n << "\n";
  18.  
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement