Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include<iostream>
  2. #include<iomanip>
  3. #include<cmath>
  4.  
  5. using namespace std;
  6. int main()
  7. {
  8. int steps,i,x=0,y=0;
  9. srand(time(NULL));
  10.  
  11. cout << "Please enter the amount of steps to be taken: ";
  12. cin >> steps;
  13. cout << endl;
  14.  
  15. for (i=0;i<=steps;i=i+3)
  16. {
  17. cout << i <<":"<< "("<<x<<","<<y<<")"<< endl;
  18.  
  19. if (rand()%2==1)
  20. { x+=3;
  21. y+=3;
  22. }
  23. else
  24. { x-=3;
  25. y-=3;
  26. }
  27.  
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement