Haval1

Question 1

Jan 19th, 2019
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include"stdafx.h"
  2. #include "string"
  3. #include <iostream>
  4. /*
  5. using function by refrence multiple two numbers (a,b) and print the resualt in main
  6. */
  7. using namespace std;
  8. void mult(int &a, int &b) {
  9.     a*=2;
  10.     b*=2;
  11. }
  12. int main()
  13. {
  14.     int a, b;
  15.     cout << "a : ";
  16.     cin >> a;
  17.     cout << "b : ";
  18.     cin >> b;
  19.     mult(a, b);
  20.     cout<<b<<endl<<a<<endl;
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment