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

 

 


Tema destacado: Rompecabezas de Bitcoin, Medio millón USD en premios


  Mostrar Mensajes
Páginas: 1 ... 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 [45] 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 ... 235
441  Programación / Programación C/C++ / Re: Problema entrada estándar en: 4 Diciembre 2018, 19:16 pm
echo "123456" | ./programa

Eso es como si ejecutaras el programa y este pidera informacion
Código:
Ingrese el numero X:
Entonces lo que le pasaste como 123456 mediante el Echo se ingresa en esa primera pregunta ya sea un scanf o un fgets o un cin

Ejemplo:

Código
  1. #include<stdio.h> //Funciones printf, fgets
  2. #include<string.h> //Funciones printf, fgets
  3.  
  4.  
  5. int main() {
  6. char temp[100];
  7. do {
  8. printf("> ");
  9. fgets(temp,100,stdin);
  10. printf("Escribio : %s",temp);
  11. }while(strncmp(temp,"exit",4));
  12. }
  13.  

entrada.txt
Código:
hola
esto es una pruba
de codigo al salir con
exit



Saludos
442  Foros Generales / Noticias / Hackean Quora? en: 4 Diciembre 2018, 03:05 am
Dear ......

We are writing to let you know that we recently discovered that some user data was compromised as a result of unauthorized access to our systems by a malicious third party. We are very sorry for any concern or inconvenience this may cause. We are working rapidly to investigate the situation further and take the appropriate steps to prevent such incidents in the future.

What Happened

On Friday we discovered that some user data was compromised by a third party who gained unauthorized access to our systems. We're still investigating the precise causes and in addition to the work being conducted by our internal security teams, we have retained a leading digital forensics and security firm to assist us. We have also notified law enforcement officials.

While the investigation is still ongoing, we have already taken steps to contain the incident, and our efforts to protect our users and prevent this type of incident from happening in the future are our top priority as a company.

What information was involved

The following information of yours may have been compromised:

    Account and user information, e.g. name, email, IP, user ID, encrypted password, user account settings, personalization data

    Public actions and content including drafts, e.g. questions, answers, comments, blog posts, upvotes

    Data imported from linked networks when authorized by you, e.g. contacts, demographic information, interests, access tokens (now invalidated)

Questions and answers that were written anonymously are not affected by this breach as we do not store the identities of people who post anonymous content.

What we are doing

While our investigation continues, we're taking additional steps to improve our security:

    We’re in the process of notifying users whose data has been compromised.
    Out of an abundance of caution, we are logging out all Quora users who may have been affected, and, if they use a password as their authentication method, we are invalidating their passwords.
    We believe we’ve identified the root cause and taken steps to address the issue, although our investigation is ongoing and we’ll continue to make security improvements.

We will continue to work both internally and with our outside experts to gain a full understanding of what happened and take any further action as needed.

What you can do

We’ve included more detailed information about more specific questions you may have in our help center, which you can find here.

While the passwords were encrypted (hashed with a salt that varies for each user), it is generally a best practice not to reuse the same password across multiple services, and we recommend that people change their passwords if they are doing so.

Conclusion

It is our responsibility to make sure things like this don’t happen, and we failed to meet that responsibility. We recognize that in order to maintain user trust, we need to work very hard to make sure this does not happen again. There’s little hope of sharing and growing the world’s knowledge if those doing so cannot feel safe and secure, and cannot trust that their information will remain private. We are continuing to work very hard to remedy the situation, and we hope over time to prove that we are worthy of your trust.

The Quora Team
443  Programación / Programación C/C++ / Re: POO en: 4 Diciembre 2018, 02:15 am
Menos mal que programo en C# 😂😂😂

El comentario no viene al caso. Favor de no hacer SPAM,

Esto
Código
  1. (const racional &R
Me marié, ya no se que hace este metodo, no se que objeto es el que modifica

El metodo toma los valores de la variable uno, le hace la operacion de potencia con 3 y lo guarda en la variable tres que es la que terminas imprimiendo en pantalla.
444  Programación / Programación C/C++ / Re: POO en: 4 Diciembre 2018, 01:01 am
A mi hay cositas que no me convence como el metodo potencia de la clase racional

Para iniciar esta bien, pero que no te convence de la potencia?

Saludos!
445  Programación / Programación C/C++ / Re: Duda de compiladores en: 3 Diciembre 2018, 15:08 pm
Tal vez te salen mas warnings, algunos compiladores en IDE, son para gente apenas entiende  del tema y le omiten ciertos Warnings.

Yo prefiero utilizar el compilador desde la terminar asi gcc -o blabla.exe blabla.c

Tambien asegurata de estar utilizando el compilador adecuado gcc para archivos c y g++ para archivos cpp hay veces que ese es el problema.

Saludos!
446  Programación / Programación C/C++ / Re: necesito ayuda aqui, plox, me podrian ayudar? en: 3 Diciembre 2018, 02:05 am
Para capturar datos te recomiendo el post que publique:

https://foro.elhacker.net/programacion_cc/plantillas_programas_escolares_en_c-t489889.0.html

Ahi podrar captirar N cantidad de empleados y sus sueldos, posteriormente solo te quedara sacar el progrmedio.

Saludos!
447  Programación / Programación C/C++ / Re: necesito ayuda aqui, plox, me podrian ayudar? en: 3 Diciembre 2018, 01:06 am
Y ahora me voy a dormir que me iba a ir cuando he visto el programa pero iba a tener pesadillas si no hacía nada al respecto. Suerte :rolleyes:

Jajajaja, ya me imagino, No me comaaa serñor fflush(stdin); ya voy a utiliza  fseek(stdin, 0, SEEK_END); como indican en ¿Queda algo en el Buffer de Entrada stdin? (Solucionado)

Por cierto date una vuelta por este tema: Lo que no hay que hacer en C/C++. Nivel basico

Saludos!

448  Programación / Programación C/C++ / Re: necesito ayuda aqui, plox, me podrian ayudar? en: 3 Diciembre 2018, 00:02 am
registro no devulve ningun tipo de dato. eso da error, ademas R es solo un caracter y no una cadena o algun otro tipo.

La concatenacion de candenas podrias realizarla mas rapido de la siguiente manera:

Código
  1. sprintf(nombrecompleto,"%s %s %s",nom,ape,apeM);

Saludos!
449  Programación / Programación C/C++ / Re: Primero en Entrar, primero en salir FIFO, Cola o Fila en: 2 Diciembre 2018, 22:50 pm
En teoría quedo esta versión, utilizando un buffer semi circular y creciendo la memoria en potencias de 2.

Tiene muchos printf para depuración, y mostrar el funcionamiento.

Código
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<string.h>
  4. #include<time.h>
  5.  
  6. typedef struct str_queue {
  7. char **queue;
  8. int len;
  9. /*
  10. Las siguientes variales son para hacer mas eficiente la asignacion de memoria
  11. len_max indica el numero de espacios len_maximos reservados actualmente, este siempre esta en potencias de 2
  12. offset indica cuantos espacios vacios hay al principio del arreglo, con el fin de no tener que reacomodar el arreglo con cada de-queue
  13. offset_max indica la cantidad cada cuantos movimientos se va a reorganizar la memoria.
  14. */
  15. int len_max;
  16. int offset;
  17. int offset_max;
  18. }Queue;
  19.  
  20. Queue *create_queue() {
  21. Queue *q = malloc(sizeof(struct str_queue));
  22. q->len = 0;
  23. q->offset = 0;
  24. q->len_max = 2;
  25. q->offset_max = 1;
  26. q->queue = malloc(sizeof(char*)*q->len_max);
  27. return q;
  28. }
  29.  
  30. void free_queue(Queue *q) {
  31. if(q) {
  32. if(q->queue)
  33. free(q->queue);
  34. free(q);
  35. }
  36. }
  37.  
  38. void en_queue(Queue *q, char *ptr) {
  39. char **temp;
  40. int i;
  41. //printf("%i == %i ?\n",q->len,q->len_max);
  42. if( q->len == q->len_max) {
  43. q->len_max *= 2;
  44. //printf("%p -> ",q->queue);
  45. temp = q->queue;
  46. q->queue = realloc(temp,q->len_max*sizeof(char*));
  47. //printf("%p\n",q->queue);
  48.  
  49. if(q->queue == NULL) {
  50. fprintf(stderr,"error realloc\n");
  51. }
  52. else {
  53. printf("Tamanio actual %i\n",q->len_max);
  54. }
  55. }
  56. if(q->queue != NULL) {
  57. printf("q->queue[%i] <- %p\n",q->len,ptr);
  58. q->queue[q->len] = ptr;
  59. q->len++;
  60. }
  61. }
  62.  
  63. char * de_queue(Queue *q) {
  64. char *r = NULL;
  65. int i,j;
  66. if((q->len - q->offset) >= 1) {
  67. r = q->queue[q->offset];
  68. printf("q->queue[%i] : %p -> out\n",q->offset,q->queue[q->offset]);
  69. q->queue[q->offset] = NULL;
  70. q->offset++;
  71. if(q->offset == q->offset_max) {
  72. //printf("%i == %i\n",q->offset,q->offset_max);
  73. i = q->offset;
  74. j = 0;
  75. //printf("i:%i  j:%i\n",i,j);
  76. while(i < q->len) {
  77. //printf("i:%i < q->len:%i\n",i,q->len);
  78. printf("q->queue[%i]: %p  <- q->queue[%i]: %p\n",j,q->queue[j],i,q->queue[i]);
  79. q->queue[j] = q->queue[i];
  80. q->queue[i] = NULL;
  81. j++;
  82. i++;
  83. }
  84. //printf("%i:q->len %i -= q->offset %i\n",(q->len-q->offset),q->len,q->offset);
  85. q->len -= q->offset;
  86. q->offset = 0;
  87. q->offset_max *=2;
  88. }
  89. }
  90. //printf("r: %p, %s\n",r,r);
  91. return r;
  92. }
  93.  
  94. int main() {
  95. char *cadenas[10] = { "Cadena_0","Cadena_1","Cadena_2","Cadena_3","Cadena_4","Cadena_5","Cadena_6","Cadena_7","Cadena_8","Cadena_9"};
  96. char *actual;
  97. int index1,index2,i =0;
  98. srand(time(NULL));
  99. Queue *q = create_queue();
  100. while(i < 1000) {
  101. index1 = rand() % 10;
  102. index2 = rand() % 10;
  103. //printf("Agregando a la fila: %p %s\n",cadenas[index1],cadenas[index1]);
  104. en_queue(q,cadenas[index1]);
  105. //printf("Agregando a la fila: %p %s\n",cadenas[index2],cadenas[index2]);
  106. en_queue(q,cadenas[index2]);
  107. de_queue(q);
  108. //printf("Saliendo de la fila %s\n",de_queue(q));
  109. i++;
  110. }
  111. free_queue(q);
  112. }
  113.  

Salidos!
450  Programación / Programación C/C++ / Re: Primero en Entrar, primero en salir FIFO, Cola o Fila en: 1 Diciembre 2018, 23:49 pm
Por lo mismo lo dije:

No es lo mas eficiente, hay muchas cosas se podrian mejorar, en especifico la forma en la que se organizan  el arreglo de elementos actuales en la Fila,  sin embargo funciono para el proposito.

Si claramente se puede manejar de mejor manera, me gusta lo de pedir memoria en potencias de 2, y lo del buffer Circular.

Pidiendo memoria de 2 en 2, requiere cambios en la estructura, en la funcion de crear para inicializar con 2 espacios disponibles y en la funcion en_queue

Código
  1. typedef struct str_queue {
  2. char **queue;
  3. int len;
  4. int max;
  5. }Queue;
  6.  
  7. Queue *create_queue() {
  8. Queue *r = malloc(sizeof(struct str_queue));
  9. r->len = 0;
  10. r->max = 2;
  11. r->queue = malloc(sizeof(char*)*r->max);
  12. return r;
  13. }
  14.  
  15. void en_queue(Queue *q, char *ptr) {
  16. if((q->len+1) == q->max) {
  17. q->max *= 2;
  18. printf("Tamanio actual %i\n",q->max);
  19. q->queue = realloc(q->queue,q->max*sizeof(char*));
  20. }
  21. if(q->queue != NULL) {
  22. q->queue[q->len] = ptr;
  23. q->len++;
  24. }
  25. }
  26.  

Saludos!
Páginas: 1 ... 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 [45] 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 ... 235
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines