|
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 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: #include<stdio.h> //Funciones printf, fgets #include<string.h> //Funciones printf, fgets int main() { char temp[100]; do { }
entrada.txt 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 (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!
|
|
|
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. #include<stdio.h> #include<stdlib.h> #include<string.h> #include<time.h> typedef struct str_queue { char **queue; int len; /* Las siguientes variales son para hacer mas eficiente la asignacion de memoria len_max indica el numero de espacios len_maximos reservados actualmente, este siempre esta en potencias de 2 offset indica cuantos espacios vacios hay al principio del arreglo, con el fin de no tener que reacomodar el arreglo con cada de-queue offset_max indica la cantidad cada cuantos movimientos se va a reorganizar la memoria. */ int len_max; int offset; int offset_max; }Queue; Queue *create_queue() { Queue *q = malloc(sizeof(struct str_queue )); q->len = 0; q->offset = 0; q->len_max = 2; q->offset_max = 1; q ->queue = malloc(sizeof(char*)*q ->len_max ); return q; } void free_queue(Queue *q) { if(q) { if(q->queue) } } void en_queue(Queue *q, char *ptr) { char **temp; int i; //printf("%i == %i ?\n",q->len,q->len_max); if( q->len == q->len_max) { q->len_max *= 2; //printf("%p -> ",q->queue); temp = q->queue; q ->queue = realloc(temp ,q ->len_max *sizeof(char*)); //printf("%p\n",q->queue); if(q->queue == NULL) { } else { printf("Tamanio actual %i\n",q ->len_max ); } } if(q->queue != NULL) { printf("q->queue[%i] <- %p\n",q ->len ,ptr ); q->queue[q->len] = ptr; q->len++; } } char * de_queue(Queue *q) { char *r = NULL; int i,j; if((q->len - q->offset) >= 1) { r = q->queue[q->offset]; printf("q->queue[%i] : %p -> out\n",q ->offset ,q ->queue [q ->offset ]); q->queue[q->offset] = NULL; q->offset++; if(q->offset == q->offset_max) { //printf("%i == %i\n",q->offset,q->offset_max); i = q->offset; j = 0; //printf("i:%i j:%i\n",i,j); while(i < q->len) { //printf("i:%i < q->len:%i\n",i,q->len); printf("q->queue[%i]: %p <- q->queue[%i]: %p\n",j ,q ->queue [j ],i ,q ->queue [i ]); q->queue[j] = q->queue[i]; q->queue[i] = NULL; j++; i++; } //printf("%i:q->len %i -= q->offset %i\n",(q->len-q->offset),q->len,q->offset); q->len -= q->offset; q->offset = 0; q->offset_max *=2; } } //printf("r: %p, %s\n",r,r); return r; } int main() { char *cadenas[10] = { "Cadena_0","Cadena_1","Cadena_2","Cadena_3","Cadena_4","Cadena_5","Cadena_6","Cadena_7","Cadena_8","Cadena_9"}; char *actual; int index1,index2,i =0; Queue *q = create_queue(); while(i < 1000) { //printf("Agregando a la fila: %p %s\n",cadenas[index1],cadenas[index1]); en_queue(q,cadenas[index1]); //printf("Agregando a la fila: %p %s\n",cadenas[index2],cadenas[index2]); en_queue(q,cadenas[index2]); de_queue(q); //printf("Saliendo de la fila %s\n",de_queue(q)); i++; } free_queue(q); }
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 typedef struct str_queue { char **queue; int len; int max; }Queue; Queue *create_queue() { Queue *r = malloc(sizeof(struct str_queue )); r->len = 0; r->max = 2; r ->queue = malloc(sizeof(char*)*r ->max ); return r; } void en_queue(Queue *q, char *ptr) { if((q->len+1) == q->max) { q->max *= 2; printf("Tamanio actual %i\n",q ->max ); q ->queue = realloc(q ->queue ,q ->max *sizeof(char*)); } if(q->queue != NULL) { q->queue[q->len] = ptr; q->len++; } }
Saludos!
|
|
|
|
|
|
|