having problem with coding.

Dec 12, 2015 at 11:02pm
ı was doing my homework. ı did the first part but ı couldnt pass to second part can somebody help me ?
also is it possible to write it in c language ?
http://i.hizliresim.com/nmDWXB.jpg


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;

int main()
{
srand(time(NULL));

int x, y;
bool xsign, ysign; // true if negative

int arrX[5];
int arrY[5];

for (int i = 0; i<5; i++)
{
x = rand() % 100;
y = rand() % 100;
xsign = rand() % 2;
ysign = rand() % 2;

if (xsign) x *= -1;
if (ysign) y *= -1;

arrX[i] = x;
arrY[i] = y;
}

for (int i = 0; i < 5; i++)
printf("%3d %3d\n", arrX[i],arrY[i]);



return 0;
}
Dec 13, 2015 at 6:32am
The image to your JPG is sideways and very hard to read.
Dec 13, 2015 at 11:14am
http://prntscr.com/9dls6s
this one is better
Dec 14, 2015 at 7:56pm
ı need help can somebody help ? please
Dec 14, 2015 at 11:21pm
Did the prof give tell you how to find the circles? That's the hard part. If not, then THINK about how you will solve it. Try to describe the solution in English first, then translate it to code.

You can generate random numbers from -100 to 100 with rand()%200 - 100;

You should probably store the cordinates as doubles since you'll be doing a bunch of math with them.
Dec 17, 2015 at 11:51pm
ı didnt get anything . still ı need help :(
Topic archived. No new replies allowed.