-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquadrante.cpp
More file actions
32 lines (26 loc) · 1 KB
/
Copy pathquadrante.cpp
File metadata and controls
32 lines (26 loc) · 1 KB
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
// Identificaçao de quadrantes atraves de coordenadas (x,y).
#include <iostream>
#include <stdio.h>
using namespace std;
// declarando variaveis do tipo float "ponto flutuante"
float x,y;
// funcao do tipo void sem return
void quadrante( float x, float y){
// testes logicos para identificar o quadrante
if (x > 0 && y < 0) { printf ("Quadrante_4"); printf("\n"); }
if (x < 0 && y < 0) { printf ("Quadrante_3"); printf("\n"); }
if (x < 0 && y > 0) { printf ("Quadrante_2"); printf("\n"); }
if(x > 0 && y > 0) { printf ("Quadrante_1"); printf("\n"); }
if (x == 0 && y == 0) { printf ("Origem"); printf("\n"); }
if (x == 0 && y > 0 || !y < 0) { printf ("Eixo Y"); printf("\n"); }
if (y == 0 && x >0 || !x < 0) { printf ("Eixo X"); printf("\n"); }
//verificacao de X e Y.
printf ("%0.1f",x); printf (" "); printf ("%0.1f",y) ;
}
// funcao principal
int main ()
{
cin >> x ; // entrada de x
cin >> y; // entrada de y
quadrante(x,y); // impressao na tela referente a funcao void
}