-
Notifications
You must be signed in to change notification settings - Fork 1
/
ativ_struct_v4.c
60 lines (52 loc) · 1.34 KB
/
ativ_struct_v4.c
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/***************************
*Atividade sobre Estruturas
*Clarice Scheibe Ribeiro
*V1 - 25/05/2015
***************************/
//bibliotecas
#include <stdio.h>
#include <stdlib.h>
//estruturas
struct Ponto2D {
float x;
float y;
};
struct CorRGB {
int r;
int g;
int b;
};
struct Circulo {
struct Ponto2D centro;
float raio;
struct CorRGB cor;
};
//funções
//preencher um Ponto2D e um Circulo com entrada pelo teclado
void leInstancias(struct Ponto2D *p, struct Circulo *c) {
printf("Recolher dados de um ponto 2D");
printf("\n *Entre com a coordenada x: ");
scanf("%f", p -> x);
printf("\n *Entre com a coordenada y: ");
scanf("%f", p -> y);
printf("Recolher dados dem um Circulo");
printf("\n *Entre com a coordenada x do centro: ");
scanf("%f", c -> centro.x);
printf("\n *Entre com a coordenada y do centro: ");
scanf("%f", c -> centro.y);
printf("\n *Entre com o o valor do raio: ");
scanf("%f", c -> raio);
printf("\n *Entre com o valor de r (cor RGB): ");
scanf("%d", c -> cor.r);
printf("\n *Entre com o valor de g (cor RGB): ");
scanf("%d", c -> cor.g);
printf("\n *Entre com o valor de b (cor RGB): ");
scanf("%d", c -> cor.b);
}
//função main
int main() {
//instâncias
struct Ponto2D ponto1;
struct Circulo circ1;
return 0;
}