syntax error in C ++
for the following section of code I keep getting these two errors:
syntax error before '}' token
and
confused by earlier errors bailing out
the small section of code is:
do
{
angle = 2*PI*rand()/RAND_MAX;
dx = cos(angle);
dy = sin(angle);
}
The whole code(that i have done):
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
int main(void)
{
int atHome=0, stepsToTry=5000, home, start;
double x, y, dx, dy, angle;
const int minx = -10;
const int maxx = 10;
const int miny = -10;
const int maxy = 10;
const double PI = 4*atan(1.0);
cout << "Will Waldo make it home? \n\n";
cout << "Input an int to start the random number generator: ";
int myStart;
cin >> myStart;
srand(myStart);
home = (((x>=8) && (x<=10)) && ((y>=8) && (y<=10)));
start = ((x = 0) && (y = 0));
for (stepsToTry = 5000; stepsToTry>0; stepsToTry = stepsToTry - 1)
{
do
{
angle = 2*PI*rand()/RAND_MAX;
dx = cos(angle);
dy = sin(angle);
}
}
return 0;
}
any help at all welcome
|