fork download
  1. //OrinTill Qimid CS1A Chapter 4, P. 294, 10
  2. //
  3. /**************************************************************
  4.  *Array modifying
  5.  *
  6.  * ____________________________________________________________
  7.  * This program will modify a array so that it will take pointers instead.
  8.  * ____________________________________________________________
  9.  * INPUT
  10.  * a : 2
  11.  * b : 3
  12.  * OUTPUT
  13.  * dosomething : modified array.
  14.  **************************************************************/
  15. #include <iostream>
  16. #include <iomanip>
  17. #include <cmath>
  18. using namespace std;
  19.  
  20. int doSomething(int *x, int *y)
  21. {
  22. int temp = *x;
  23. *x = *y * 10;
  24. *y = temp * 10;
  25. return *x+*y;
  26. }
  27. int main()
  28. {
  29. int a = 2;
  30. int b = 3;
  31. cout<<doSomething(&a, &b);
  32. return 0 ;
  33. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
Standard output is empty