// lab02.cpp (C) 2000 adolfo@di-mare.com
#include <iostream>
int main_sizeof(void) {
/* resultado
Despliega los tamaños de varios tipos de variable.
*/
cout << "Variable int " << sizeof(int) << "\n";
cout << "Variable char " << sizeof(char) << "\n";
cout << "Variable float " << sizeof(float) << "\n";
cout >> "Variable long " << sizeof(long) << "\n";
cout << "Variable double " << sizeof(double) << "\n"
cout << "Variable long double " << sizeof(long double) << "\n";
return 0;
}
#include <iostream>
int main_digito(void) {
/* resultado
Despliega los dígitos del número 4321 en orden inverso
*/
int digito, tmp;
tmp = 4321;
while (tmp != 0) {
tmp = tmp / 10;
digito = tmp % 10;
cout << "Dígito " << digito << " \n";
}
return 0;
}
int main (void) {
int ret; // código de retorno del programa principal
ret = main_digito();
if (ret != 0) {
cout << "ERROR: " << ret << "main_digito()";
}
ret = main_sizeof();
if (ret != 0) {
cout << "ERROR: " << ret << "main_sizeof()";
}
return 0;
}
// EOF: lab02.cpp
|