-
Lenguaje
C++
-
Descripción
Pide ingresar las coordenadas de un punto en el plano, es decir, dos valores enteros x e y. Posteriormente imprime en pantalla en qué cuadrante se ubica dicho punto.
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
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
#ifdef __MSDOS__
#include <iostream.h>
#include <stdlib.h>
#else
#include <iostream>
#include <cstdlib>
using namespace std;
#endif
int main (void)
{
int x, y;
cout << "Ingresa el valor de x: ";
cin >> x;
cin.get();
cout << "Ingresa el valor de y: ";
cin >> y;
cin.get();
if(x==0&&y==0)
cout << "Origen" << endl;
if(x==0)
cout << "Eje Y" << endl;
if(y==0)
cout << "Eje X" << endl;
if(x>0&&y>0)
cout << "Cuadrante I" << endl;
if(x<0&&y>0)
cout << "Cuadrante II" << endl;
if(x<0&&y<0)
cout << "Cuadrante III" << endl;
if(x>0&&y<0)
cout << "Cuadrante VI" << endl;
cout << endl;
system ("pause");
return EXIT_SUCCESS;
}
#include <iostream.h>
#include <stdlib.h>
#else
#include <iostream>
#include <cstdlib>
using namespace std;
#endif
int main (void)
{
int x, y;
cout << "Ingresa el valor de x: ";
cin >> x;
cin.get();
cout << "Ingresa el valor de y: ";
cin >> y;
cin.get();
if(x==0&&y==0)
cout << "Origen" << endl;
if(x==0)
cout << "Eje Y" << endl;
if(y==0)
cout << "Eje X" << endl;
if(x>0&&y>0)
cout << "Cuadrante I" << endl;
if(x<0&&y>0)
cout << "Cuadrante II" << endl;
if(x<0&&y<0)
cout << "Cuadrante III" << endl;
if(x>0&&y<0)
cout << "Cuadrante VI" << endl;
cout << endl;
system ("pause");
return EXIT_SUCCESS;
}