elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: (TUTORIAL) Aprende a emular Sentinel Dongle By Yapis


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación C/C++ (Moderadores: Eternal Idol, Littlehorse, K-YreX)
| | |-+  Programa para Llevar de TB a GB,MB,KB...
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: 1 [2] Ir Abajo Respuesta Imprimir
Autor Tema: Programa para Llevar de TB a GB,MB,KB...  (Leído 15,049 veces)
тαптяα


Desconectado Desconectado

Mensajes: 1.151


Sic utere tuo ut alienum non laeda


Ver Perfil WWW
Re: Programa para Llevar de TB a GB,MB,KB...
« Respuesta #10 en: 26 Junio 2011, 21:45 pm »

Me alegro, que lo hayas entendido todo.

Cualquier otra cosa, preguntala.  ;D


En línea

BlackZeroX
Wiki

Desconectado Desconectado

Mensajes: 3.158


I'Love...!¡.


Ver Perfil WWW
Re: Programa para Llevar de TB a GB,MB,KB...
« Respuesta #11 en: 26 Junio 2011, 23:20 pm »

.
Revisa la definicion de TeraByte ( 1TB = 1024 GB =  1048576 MB = 1073741824 kb = 1099511627776 bytes)

http://www.google.com/search?client=safari&rls=en&q=1+terbyte+a+bytes&ie=UTF-8&oe=UTF-8

Código
  1.  
  2. #include <stdio.h>
  3. int main() {
  4.    // multiplicacion 1024 de manera binaria ( Dezplazamiento de bits ).
  5.    int bytes  = 1;
  6.    fprintf(stdout,"El Resultado en GB es= %d  \n",bytes<<30);
  7.    fprintf(stdout,"El Resultado en MB es= %d  \n",bytes<<20);
  8.    fprintf(stdout,"El Resultado en KB es= %d \n",bytes<<10);
  9.    fprintf(stdout,"El Resultado en Bytes es= %d \n",bytes);
  10.    getchar();
  11.    return 0;
  12. }
  13.  
  14.  

temibles Lunas!¡.


« Última modificación: 26 Junio 2011, 23:27 pm por BlackZeroX▓▓▒▒░░ » En línea

The Dark Shadow is my passion.
тαптяα


Desconectado Desconectado

Mensajes: 1.151


Sic utere tuo ut alienum non laeda


Ver Perfil WWW
Re: Programa para Llevar de TB a GB,MB,KB...
« Respuesta #12 en: 26 Junio 2011, 23:30 pm »

.
Revisa la definicion de TeraByte ( 1TB = 1024 GB =  1048576 MB = 1073741824 kb = 1099511627776 bytes)

http://www.google.com/search?client=safari&rls=en&q=1+terbyte+a+bytes&ie=UTF-8&oe=UTF-8

Código
  1.  
  2. #include <stdio.h>
  3. int main() {
  4.    // multiplicacion 1024 de manera binaria ( Dezplazamiento de bits ).
  5.    int bytes  = 1;
  6.    fprintf(stdout,"El Resultado en GB es= %d  \n",bytes<<30);
  7.    fprintf(stdout,"El Resultado en MB es= %d  \n",bytes<<20);
  8.    fprintf(stdout,"El Resultado en KB es= %d \n",bytes<<10);
  9.    fprintf(stdout,"El Resultado en Bytes es= %d \n",bytes);
  10.    getchar();
  11.    return 0;
  12. }
  13.  
  14.  

temibles Lunas!¡.

muy bien campeón :)

y cuanto es 1024 * 1024 jajajajaja
En línea

leogtz
. . .. ... ..... ........ ............. .....................
Colaborador
***
Desconectado Desconectado

Mensajes: 3.069


/^$/


Ver Perfil WWW
Re: Programa para Llevar de TB a GB,MB,KB...
« Respuesta #13 en: 27 Junio 2011, 00:40 am »

Cuando la función main está como:

main()

está implicito que devuelve un int, no es void, para que sea void se tiene que especificar de manera explícita:

void main().

Los nuevos estándares creo que cuando se omite la sentencia return ellos automáticamente devuelven un 0.

Saludos.
En línea

Código
  1. (( 1 / 0 )) &> /dev/null || {
  2. echo -e "stderrrrrrrrrrrrrrrrrrr";
  3. }
  4.  
http://leonardogtzr.wordpress.com/
leogutierrezramirez@gmail.com
BlackZeroX
Wiki

Desconectado Desconectado

Mensajes: 3.158


I'Love...!¡.


Ver Perfil WWW
Re: Programa para Llevar de TB a GB,MB,KB...
« Respuesta #14 en: 27 Junio 2011, 01:03 am »

.
que idiota, no se en que demonios estaba pensando...

Código
  1.  
  2. #include <stdio.h>
  3. int main() {
  4.    float GBytes = 1024.0f
  5.    fprintf( stdout , "El Resultado en TB es= %.2f  \n" , GBytes/1024 );
  6.    fprintf( stdout , "El Resultado en MB es= %.2f  \n" , GBytes*1024);
  7.    fprintf( stdout , "El Resultado en KB es= %.2f  \n" , GBytes*1048576);
  8.    fprintf( stdout , "El Resultado en Bytes es= %.2f \n" , GBytes*1073741824);
  9.    getchar(  );
  10.    return 0;
  11. }
  12.  
  13.  

Dulces Lunas!¡.
.
« Última modificación: 27 Junio 2011, 01:04 am por BlackZeroX▓▓▒▒░░ » En línea

The Dark Shadow is my passion.
тαптяα


Desconectado Desconectado

Mensajes: 1.151


Sic utere tuo ut alienum non laeda


Ver Perfil WWW
Re: Programa para Llevar de TB a GB,MB,KB...
« Respuesta #15 en: 27 Junio 2011, 11:29 am »

Cuando la función main está como:

main()

está implicito que devuelve un int, no es void, para que sea void se tiene que especificar de manera explícita:

void main().

Los nuevos estándares creo que cuando se omite la sentencia return ellos automáticamente devuelven un 0.

Saludos.
Pues nose donde leí que era al revés..pero bueno creo que tienes razón.
En línea

Queta

Desconectado Desconectado

Mensajes: 267



Ver Perfil
Re: Programa para Llevar de TB a GB,MB,KB...
« Respuesta #16 en: 27 Junio 2011, 12:19 pm »

Citar
5.1.2.2.1 Program startup
1 The function called at program startup is named main. The implementation declares no
prototype for this function. It shall be defined with a return type of int and with no
parameters:
int main(void) { /* ... */ }
or with two parameters (referred to here as argc and argv, though any names may be
used, as they are local to the function in which they are declared):
int main(int argc, char *argv[]) { /* ... */ }
or equivalent;9) or in some other implementation-defined manner.
2 If they are declared, the parameters to the main function shall obey the following
constraints:
— The value of argc shall be nonnegative.
— argv[argc] shall be a null pointer.
— If the value of argc is greater than zero, the array members argv[0] through
argv[argc-1] inclusive shall contain pointers to strings, which are given
implementation-defined values by the host environment prior to program startup. The
intent is to supply to the program information determined prior to program startup
from elsewhere in the hosted environment. If the host environment is not capable of
supplying strings with letters in both uppercase and lowercase, the implementation
shall ensure that the strings are received in lowercase.
— If the value of argc is greater than zero, the string pointed to by argv[0]
represents the program name; argv[0][0] shall be the null character if the
program name is not available from the host environment. If the value of argc is
greater than one, the strings pointed to by argv[1] through argv[argc-1]
represent the program parameters.
— The parameters argc and argv and the strings pointed to by the argv array shall
be modifiable by the program, and retain their last-stored values between program
startup and program termination.

9) Thus, int can be replaced by a typedef name defined as int, or the type of argv can be written as
char ** argv, and so on.
En línea

"Intenta no volverte un hombre de éxito, sino volverte un hombre de valor." Albert Einstein.
Páginas: 1 [2] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Spielberg invierte para llevar a la pantalla el caso de Wikileaks
Noticias
wolfbcn 0 1,640 Último mensaje 3 Marzo 2011, 02:11 am
por wolfbcn
EE UU amplia las citaciones para llevar ante la justicia la filtración de ...
Noticias
wolfbcn 0 1,361 Último mensaje 10 Junio 2011, 02:28 am
por wolfbcn
Quince aplicaciones imprescindibles para llevar en tu USB
Noticias
wolfbcn 0 2,872 Último mensaje 17 Mayo 2012, 14:00 pm
por wolfbcn
Slax 7.0, Linux para llevar. A fondo
Noticias
wolfbcn 0 1,758 Último mensaje 13 Diciembre 2012, 15:06 pm
por wolfbcn
Aplicaciones imprescindibles para llevar en una memoria USB
Noticias
wolfbcn 0 2,600 Último mensaje 9 Noviembre 2013, 14:18 pm
por wolfbcn
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines