Está en la página 1de 1

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

/* 145313 - JOSE MERINO GONZALES - ING. SISTEMAS - IEVD UNIMINUTO */


/* PROGRAMACIN 2 - 2010 SEPTIEMBRE 14 */
#include <iostream>
#include <conio2.h>
using namespace std;
int intNumero, intUnidades, intDecenas, intCentenas;
int main() {
cout << "Ingresa un n\xA3mero de tres cifras: " << endl << endl ;
cin >> intNumero ;
while ( intNumero <= 0 || intNumero > 999 ) { // validacin del numero ingresado.
cout << endl ;
cout << "El n\xA3mero debe ser positivo y menor que 1,000." << endl << endl ;
cout << "Presiona una tecla para continuar..." << endl << endl ;
getch();
clrscr();
cout << "Ingresa un n\xA3mero de tres cifras: " << endl << endl ;
cin >> intNumero ;
} // fin while
intUnidades = intNumero%10 ; // intUnidades es el resto de dividir el numero/10
intNumero = intNumero/10 ; // El cociente entero es el nuevo nmero que hay que dividir
intDecenas = intNumero%10 ; // intDecenas es el resto de dividir nuevamente el Cociente/10
intCentenas = intNumero/10 ; // intCentenas es el cociente entero de esa misma divisin.
cout
cout
cout
cout

<<
<<
<<
<<

endl ;
"Unidades: " << intUnidades << endl ;
" Decenas: " << intDecenas << endl ;
"Centenas: " << intCentenas << endl ;

getch();
return 0 ;
} // fin main
//***************************************************************************************
//***************************************************************************************
//
\xA8

\xA0
//
? ?

\x82
//
\xAD

\xA1
//
! !

\xA2
//
\xA4

\xA3
//
\xA5

También podría gustarte