Okay well I've now got this which just appears to make the program wait and I can't work out why. Am I using the functions correctly?
Code:
bad_input = 1;
do
{
printf("Please enter arguments in the order: negative mass, positive mass, initial x-position, initial y-position, initial x-velocity, initial y-velocity:\n");
if ( fgets(str,60,stdin) != NULL )
{
if ( sscanf(str,"%lf %lf %lf %lf %lf %lf",&MassMinus,&MassPlus,&Pos[0][0],&Pos[0][1],&Vel[0][0],&Vel[0][1]) != 6)
{
printf("Numbers were not entered correctly!\n");
}
if ( scanf("%lf %lf %lf %lf %lf %lf",&MassMinus,&MassPlus,&Pos[0][0],&Pos[0][1],&Vel[0][0],&Vel[0][1]) != 6)
{
printf("Not all numbers were assigned!\n");
}
else if (MassMinus < 0 || MassPlus < 0)
{
printf("Masses must be positive!\n");
}
else if ( (Pos[0][0]-1)*(Pos[0][0]-1)+Pos[0][1]*Pos[0][1] < Error*Error)
{
printf("Initial position is too close to the positive mass and will collide instantly!\n");
}
else if ( (Pos[0][0]+1)*(Pos[0][0]+1)+Pos[0][1]*Pos[0][1] < Error*Error)
{
printf("Initial position is too close to the negative mass and will collide instantly!\n");
}
else
{
bad_input = 0; /* if we reach here, we're happy with the input */
}
}
} while (bad_input);