Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -----------------------------------------
- QUESTAO 1
- ---------
- typedef struct Ponto
- {
- float px;
- float py;
- }Ponto;
- -----------------------------------------
- QUESTAO 2
- ---------
- void atribuiValorPonto(float a, float b, struct Ponto *p)
- {
- p->px = a;
- p->py = b;
- }
- -----------------------------------------
- QUESTAO 3
- ---------
- typedef struct Triangulo
- {
- Ponto a;
- Ponto b;
- Ponto c;
- }Triangulo;
- -----------------------------------------
- QUESTAO 4
- ---------
- float perimetro_tri(Ponto a, Ponto b, Ponto c)
- {
- float peri;
- float normaAB, normaAC, normaBC;
- normaAB = sqrt( pow((b.px - a.px),2) + pow((b.py - a.py),2) );
- normaAC = sqrt( pow((c.px - a.px),2) + pow((c.py - a.py),2) );
- normaBC = sqrt( pow((c.px - b.px),2) + pow((c.py - b.py),2) );
- peri = normaAB + normaAC + normaBC;
- return peri;
- }
- -----------------------------------------
- QUESTAO 5
- ---------
- float area_tri(Ponto a, Ponto b, Ponto c)
- {
- float area;
- float peri;
- float normaAB, normaAC, normaBC;
- normaAB = sqrt( pow((b.px - a.px),2) + pow((b.py - a.py),2) );
- normaAC = sqrt( pow((c.px - a.px),2) + pow((c.py - a.py),2) );
- normaBC = sqrt( pow((c.px - b.px),2) + pow((c.py - b.py),2) );
- peri = normaAB + normaAC + normaBC;
- area = sqrt( (peri/2)*((peri/2) - normaAB)*((peri/2) - normaAC)*((peri/2) - normaBC) );
- return area;
- }
- -----------------------------------------
- QUESTAO 6
- ---------
- int teste_tri(Ponto a, Ponto b, Ponto c)
- {
- float normaAB, normaAC, normaBC;
- normaAB = sqrt( pow((b.px - a.px),2) + pow((b.py - a.py),2) );
- normaAC = sqrt( pow((c.px - a.px),2) + pow((c.py - a.py),2) );
- normaBC = sqrt( pow((c.px - b.px),2) + pow((c.py - b.py),2) );
- if(normaAB == normaAC && normaAC == normaBC){
- return 1;
- }
- else return 0;
- }
- -----------------------------------------
- QUESTAO 7
- ---------
- typedef struct Circunferencia
- {
- Ponto centro;
- float raio;
- }Circunferencia;
- -----------------------------------------
- QUESTAO 8
- ---------
- float perimetro_circ(Circunferencia a)
- {
- float perimetro;
- perimetro = 2*PI*a.raio;
- return perimetro;
- }
- -----------------------------------------
- QUESTAO 9
- ---------
- float area_circ(Circunferencia a)
- {
- float area;
- area = PI*a.raio*a.raio;
- return area;
- }
- -----------------------------------------
- QUESTAO 10
- ----------
- int verif_circ(Circunferencia c1, Ponto p1)
- {
- float eq;
- eq = pow((p1.px - c1.centro.px),2) + pow((p1.py - c1.centro.py),2);
- if(eq == c1.raio*c1.raio) return 1;
- else return 0;
- }
- -----------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement