Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<iomanip>
- #include<cmath>
- using namespace std;
- int main()
- {
- int steps,i,x=0,y=0;
- srand(time(NULL));
- cout << "Please enter the amount of steps to be taken: ";
- cin >> steps;
- cout << endl;
- for (i=0;i<=steps;i=i+3)
- {
- cout << i <<":"<< "("<<x<<","<<y<<")"<< endl;
- if (rand()%2==1)
- { x+=3;
- y+=3;
- }
- else
- { x-=3;
- y-=3;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement