<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hola, recién me inicio en c++ y estaba resolviendo los ejercicios del final del capitulo y me encontré con uno que no he podido resolver. El problema dice:<BR>Escriba un programa que reciba como entrada un número entero de cinco dígitos, que separe ese número en sus dígitos individuales y los imprima, cada uno separado de los demás por tres espacios. Me sugiere que utilice los operadores de división entera y módulo.<BR>Porgrama:<BR>#include <iosteam><BR>using namespace std;<BR> <BR>int main ()<BR>{<BR>int entero;<BR> <BR>cout << "Introduce un entero de 5 dígitos: ";<BR>cin >> entero;<BR>// voy a poner como entero al 42339<BR><font size="2"> </font><font color="#0000ff" size="2"><font color="#0000ff" size="2"></font></font><BR><font color="#0000ff" size="2"><font color="#0000ff" size="2">int</font></font><font size="2"> d5 = 42339 % 10;</font><font color="#008000" size="2"><font color="#008000" size="2">//9 esto seria el dígito quinto no más este me sale los de abajo no</font></font><BR><font color="#008000" size="2"><font color="#008000" size="2">
</font></font><font size="2"></font><BR><font size="2"> </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">int</font></font><font size="2"> d4 = 42339 % 100; </font><font color="#008000" size="2"><font color="#008000" size="2">//39</font></font><BR><font color="#008000" size="2"><font color="#008000" size="2">
</font></font><font size="2"></font><BR><font size="2"> </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">int</font></font><font size="2"> d3 = 42339 % 1000; </font><font color="#008000" size="2"><font color="#008000" size="2">//339</font></font><BR><font color="#008000" size="2"><font color="#008000" size="2">
</font></font><font size="2"></font><BR><font size="2"> </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">int</font></font><font size="2"> d2 = 42339 % 10000; </font><font color="#008000" size="2"><font color="#008000" size="2">//2339</font></font><BR><font color="#008000" size="2"><font color="#008000" size="2">
</font></font><font size="2"></font><BR><font size="2"> </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">int</font></font><font size="2"> d1 = 42339 % 100000; </font><font color="#008000" size="2"><font color="#008000" size="2">//42339</font></font><BR><font color="#008000" size="2"><font color="#008000" size="2">

//</font></font><font size="2"></font><BR><font size="2">       </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">int</font></font><font size="2"> df4 = d4 % 10;</font><BR><font size="2">
</font><BR><font size="2">  </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">int</font></font><font size="2"> df3 = d3 % 100;</font><BR> <BR><font size="2">
<BR>cout << d5 << endl;<BR>
<BR>cout << d4 << endl;<BR>
<BR>cout << d3 << endl;<BR>
<BR>cout << d2 << endl;<BR>
<BR>cout << d1 << endl;<BR>
//<BR>cout << df4 << endl;<BR>
<BR>cout << df3 << endl;<BR>
// ya después pondría los tres espacios eso sí sé como<BR></font><font size="2">system(</font><font color="#a31515" size="2"><font color="#a31515" size="2">"pause"</font></font><font size="2">);</font><BR><font size="2">
</font><font color="#0000ff" size="2"><font color="#0000ff" size="2"></font></font><BR><font color="#0000ff" size="2"><font color="#0000ff" size="2">return</font></font><font size="2"> 0;</font><BR> <BR> <BR>}<BR> <BR>es lo que he podido hacer<BR>Muchas gracias!<BR>*envié antes un mensaje de este problema pero lo envié sin querer y no estaba terminado <BR>                                      </div></body>
</html>