-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.cpp
46 lines (44 loc) · 1.39 KB
/
Main.cpp
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
37
38
39
40
41
42
43
44
45
46
#include <time.h> /* time */
#include <stdio.h>
#include <stdlib.h> /* srand, rand */
#include <string.h>
#include <math.h>
#include "Dessin.h"
//-----------------------------------------------------------------------------
// my_rand : retourne une valeur entière dans l'intervalle [0 ; 16777215]
//-----------------------------------------------------------------------------
int my_rand(void)
{
static int first = 0;
int randomValue;
if (first == 0)
{
srand (time (NULL));
first = 1;
}
randomValue = (int)(rand() / (double)RAND_MAX * (0x0FF));
//randomValue = rand() % N;
return randomValue;
}
//-----------------------------------------------------------------------------
// PROGRAMME PRINCIPAL
//-----------------------------------------------------------------------------
int main()
{
int i;
int WIDTH = 450;
int HEIGHT = 450;
Dessin *image = new Dessin(WIDTH, HEIGHT);
if (!image->isOk())
return EXIT_FAILURE;
for (i=4; i<=WIDTH/2; i+=8)
{
image->Ligne(WIDTH/2, i, WIDTH/2+i, HEIGHT/2);
image->Ligne(WIDTH/2, i, WIDTH/2-i, HEIGHT/2);
image->Ligne(WIDTH/2, i+HEIGHT/2, WIDTH-i, HEIGHT/2);
image->Ligne(WIDTH/2, i+HEIGHT/2, i, HEIGHT/2);
}
image->enregistrerSous("A:/example2.bmp");
delete image;
return EXIT_SUCCESS;
}