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


Tema destacado: Recuerda que debes registrarte en el foro para poder participar (preguntar y responder)


Páginas: 1 2 3 4 5 6 7 [8] 9 10
 71 
 en: 28 Junio 2025, 17:01 pm 
Iniciado por El_Andaluz - Último mensaje por El_Andaluz


Los rebeldes hutíes del Yemen reivindicaron este sábado el lanzamiento de un misil balístico contra un “objetivo estratégico” en la localidad de Beersheba, en el sur de Israel, un ataque que según el Ejército israelí fue interceptado sin provocar daños o víctimas.

El portavoz militar de los insurgentes, Yahya Sarea, dijo en un comunicado que el grupo aliado del régimen de Irán efectuó “una operación militar de alta calidad contra un objetivo estratégico del enemigo israelí en la zona ocupada de Beersheba utilizando un misil balístico Zulfiqar”, mientras que aseguró que el ataque “logró su objetivo con éxito”.

Esta acción, la primera reivindicada por los hutíes después de la tregua entre Israel e Irán alcanzada esta semana y que puso fin a una guerra de 12 días, fue “en respuesta a los crímenes del criminal enemigo sionista contra la población civil de la Franja de Gaza”, de acuerdo con Sarea.

Por otra parte, añadió que la semana pasada los rebeldes yemeníes también efectuaron varias operaciones militares contra “lugares estratégicos e instalaciones militares” israelíes en Beersheba, Tel Aviv y Haifa, en el norte de Israel, localidades contra las que lanzaron “varios misiles balísticos y drones”.

El vocero no aportó más detalles sobre esos ataques, si bien aseguró que tuvieron “éxito”.

“El Yemen, con su pueblo leal y orgulloso, su fiel liderazgo y su ejército luchador, no abandonará sus deberes religiosos, morales y humanitarios hacia el oprimido pueblo palestino, sin importar las repercusiones”, afirmó Sarea, que añadió que los hutíes continuarán atacando Israel “hasta que cese la agresión contra Gaza”.

Los hutíes han lanzado decenas de ataques contra Israel desde el estallido de la guerra en Gaza a finales de 2023, pero también contra la navegación comercial en el mar Rojo, lo que ha provocado grandes disrupciones en la navegación comercial en esta importante vía marítima.

Por su parte, el régimen de Irán realizó este sábado los funerales de Estado para los altos mandos militares y científicos nucleares abatidos durante su reciente conflicto con Israel, en medio de una creciente tensión diplomática con el presidente estadounidense Donald Trump.

Los medios estatales calificaron el acto como un homenaje a los “mártires de la guerra impuesta por el régimen sionista”. Imágenes difundidas mostraron ataúdes cubiertos con banderas iraníes y retratos de los fallecidos uniformados, dispuestos en la Plaza Enghelab de Teherán. La ceremonia continuó con una procesión hasta la Plaza Azadi, a unos 11 kilómetros de distancia.

Entre los muertos se encuentran el general Mohammad Bagheri, número dos de las Fuerzas Armadas iraníes, y el comandante de la Guardia Revolucionaria, Hossein Salami, ambos abatidos en ataques israelíes. También falleció el científico nuclear Mohammad Mehdi Tehranchi.

Mohsen Mahmoudi, jefe del Consejo de Coordinación para el Desarrollo Islámico de Teherán, calificó la jornada como “histórica para Irán islámico y la revolución”.

El conflicto, que duró 12 días y comenzó el 13 de junio, finalizó con un alto el fuego, con ambas partes proclamando victoria.





 72 
 en: 28 Junio 2025, 09:49 am 
Iniciado por PanaceR - Último mensaje por Mr.Byte
No soy programador en C++, me he limitado a pasarlo por IA, para que opinase sobre el código
Código:
// This C++ program implements a simple contact management system using a linked list,
// allowing users to add, extract, delete, and display contacts along with sorting options.
// However, it suffers from multiple issues including memory management with malloc/free,
// lack of error handling, unused variables, lack of function documentation, and potential edge cases.

// Key improvement opportunities include:
// - Replace `malloc` with `new` and `free` with `delete` for proper C++ memory management.
// - Improve input validation to prevent processing invalid data.
// - Enhance usability by adding more descriptive prompts and error messages.
// - Refactor complex methods to improve readability and maintainability.
// - Ensure all parts of the program use consistent data types and best practices.

#include "iostream"  // For input and output operations
#include "stdlib.h"  // Standard library for memory allocation functions
#include "fstream"   // For file input and output operations
#include "cstdlib"   // Provides access to functions like rand() and malloc()
using namespace std;

// Struct representing a contact with various attributes
struct contacto {
    int ID;              // Unique identifier for the contact
    char RFC[15];       // RFC field for the contact
    char nombre[30];    // Name of the contact
    char apellidos[30]; // Surname of the contact
    char telefono[15];  // Telephone number of the contact
    char celular[15];   // Cell phone number of the contact
    char correo[50];    // Email address of the contact
    char fecha[15];     // Birth date of the contact in DD/MM/AA format
};

// Struct for linked list node, containing a contact and a pointer to the next node
struct nodo {
    contacto info;      // Contact information
    nodo *siguiente;    // Pointer to the next node in the list
};

nodo *raiz = NULL;      // The head pointer of the linked list

// Function prototypes
int vacia();                              // Checks if the list is empty
int cantidad();                           // Returns the number of contacts in the list
void insertar(int pos, contacto x);      // Inserts a contact at a specified position
void imprimir();                          // Prints all contacts
contacto extraer(int pos);                // Extracts a contact from a specified position
void borrar(int pos);                     // Deletes a contact at a specified position
void intercambiar(int pos1, int pos2);   // Swaps two contacts at specified positions
void ordenamenormayor();                  // Sorts contacts in ascending order by ID
void ordenamayormenor();                   // Sorts contacts in descending order by ID
void menu();                              // Displays the menu and handles user input
void capturadato(contacto &dato);       // Captures data for a contact
void Imprimirdato(contacto dato);        // Prints a specific contact's data
void guarda();                            // Saves the contacts to a file
void Leer();                              // Reads contacts from a file

int main() {
    Leer();  // Load contacts from the file at program start
    menu();  // Display the menu to the user
    return 0; // End of the program
}

// Function to check if the list is empty
int vacia() {
    return (raiz == NULL) ? 1 : 0; // Returns 1 if empty, otherwise returns 0
}

// Function to get the total number of contacts in the list
int cantidad() {
    nodo *reco = raiz; // Start from the head of the linked list
    int cant = 0;      // Initialize count
    while (reco != NULL) { // Traverse until the end of the list
        reco = reco->siguiente; // Move to the next node
        cant++;  // Increment the count
    }
    return cant; // Return the total count of contacts
}

// Function to insert a new contact at a specific position in the list
void insertar(int pos, contacto x) {
    nodo *nuevo;                          // Pointer for the new node
    // IMPROVEMENT: Use new instead of malloc for C++ memory management
    nuevo = (nodo*) malloc(sizeof(nodo)); // Allocate memory for the new node
    nuevo->info = x;                     // Set the contact info for the new node

    // Check if the position is valid for insertion
    if (pos <= cantidad() + 1) {
        if (pos == 1) { // Insert at the head
            nuevo->siguiente = raiz; // Point to the current head
            raiz = nuevo; // Update the head to the new node
        } else {
            // Navigate to the specified position
            nodo *reco = raiz;
            if (pos <= cantidad() + 1) { // If inserting at the end
                while (reco->siguiente != NULL) { // Traverse to the end
                    reco = reco->siguiente; // Move to the next node
                }
                reco->siguiente = nuevo; // Link the new node at the end
                nuevo->siguiente = NULL; // Terminate the new node's next pointer
            } else { // Insert in the middle
                for (int i = 1; i <= pos - 2; i++) { // Navigate to the insertion point
                    reco = reco->siguiente;
                }
                nodo *sig = reco->siguiente; // Save the current next node
                reco->siguiente = nuevo; // Link the new node
                nuevo->siguiente = sig; // Link the saved node after the new node
            }
        }
    } else {
        // IMPROVEMENT: Handle invalid insertion positions
        cout << "Posición inválida para insertar" << endl;
        // NEEDS TO HANDLE INVALID OPTIONS PROPERLY
    }
}

// Function to print all contacts in the list
void imprimir() {
    nodo *reco = raiz; // Start from the head of the linked list
    if (vacia() == 1) { // Check if the list is empty
        cout << "Lista está vacía: " << endl; // Notify user
    } else {
        cout << "Lista está completa: " << endl; // Notify user
        while (reco != NULL) { // Traverse and print each contact
            Imprimirdato(reco->info); // Print contact information
            reco = reco->siguiente; // Move to the next node
        }
        cout << endl; // New line at the end of output
    }
}

// Function to extract a contact from a specified position
contacto extraer(int pos) {
    contacto informacion; // Variable to store the extracted contact info
    // Check if the position is valid for extraction
    if (pos <= cantidad()) {
        nodo *bor; // Pointer to be deleted
        if (pos == 1) { // Extract from the head
            informacion = raiz->info; // Store information from the head
            bor = raiz; // Pointer to be deleted
            raiz = raiz->siguiente; // Update head to the next node
        } else {
            nodo *reco = raiz; // Start from head to find the contact
            for (int i = 1; i <= pos - 2; i++) { // Navigate to one before the target
                reco = reco->siguiente; // Move to the next node
            }
            nodo *prox = reco->siguiente; // Pointer to the contact to be deleted
            reco->siguiente = prox->siguiente; // Link to the next of the contact to be deleted
            bor = prox; // Holds the contact to be deleted
        }
        // IMPROVEMENT: Use delete instead of free for C++ memory management
        free(bor); // Delete the node from memory
        return informacion; // Return the extracted contact info
    }
    // IMPROVEMENT: Handle the case where position is invalid
    cout << "Posición inválida para extracción" << endl; // Notify user
    // NEEDS TO HANDLE INVALID EXTRACTION PROPERLY
}

// Function to delete a contact at a specified position
void borrar(int pos) {
    // Check if the position is valid for deletion
    if (pos <= cantidad()) {
        nodo *bor; // Node to be free
        if (pos == 1) { // Remove from head
            bor = raiz; // Node to be deleted
            raiz = raiz->siguiente; // Update head to the next node
        } else {
            nodo *reco = raiz; // Start from head to find the contact
            for (int i = 1; i <= pos - 2; i++) { // Navigate to one before the target
                reco = reco->siguiente;
            }
            nodo *prox = reco->siguiente; // Pointer to the contact to be deleted
            bor = prox; // Holds the contact to be deleted
            reco->siguiente = prox->siguiente; // Remove the pointer to the contact to be deleted
        }
        // IMPROVEMENT: Use delete instead of free for C++ memory management
        free(bor); // Free the memory occupied by the deleted node
    }
    // IMPROVEMENT: Handle the case where position is invalid
    else {
        cout << "Posición inválida para borrar." << endl; // Notify user
        // NEEDS TO HANDLE INVALID DELETION PROPERLY
    }
}

// Function to swap two contacts at specified positions
void intercambiar(int pos1, int pos2) {
    // Check if both positions are valid
    if (pos1 <= cantidad() && pos2 <= cantidad()) {
        nodo *reco1 = raiz; // Start from head to find first contact
        for (int f = 1; f < pos1; f++) { // Navigate to first contact
            reco1 = reco1->siguiente;
        }
        nodo *reco2 = raiz; // Start from head to find second contact
        for (int f = 1; f < pos2; f++) { // Navigate to second contact
            reco2 = reco2->siguiente;
        }
        // Swap the information of the two contacts
        contacto aux = reco1->info; // Temporary storage of info from first contact
        reco1->info = reco2->info; // Assign second contact's info to the first
        reco2->info = aux; // Assign stored info to the second contact
    }
    // IMPROVEMENT: Handle the case where one or both positions are invalid
    else {
        cout << "Posiciones inválidas para intercambio." << endl; // Notify user
        // NEEDS TO HANDLE INVALID INTERCHANGE PROPERLY
    }
}

// Function to sort contacts in ascending order by ID
void ordenamenormayor() {
    nodo *reco1 = raiz; // Start from the head of the list
    nodo *reco2; // Pointer for nested traversal
    // Traverse each element with nested traversal to sort
    while (reco1 != NULL) {
        reco2 = reco1->siguiente; // Start comparing with next elements
        while (reco2 != NULL) {
            if (reco2->info.ID < reco1->info.ID) { // Compare IDs for sorting
                // Swap the contact info if out of order
                contacto aux = reco2->info; // Temporary storage
                reco2->info = reco1->info; // Replace info
                reco1->info = aux; // Save the original info back to first
            }
            reco2 = reco2->siguiente; // Move to next node
        }
        reco1 = reco1->siguiente; // Move to the next node to sort
    }
}

// Function to sort contacts in descending order by ID
void ordenamayormenor() {
    nodo *reco1 = raiz; // Start from head for outer loop
    nodo *reco2; // Pointer for inner loop
    // Nested traversal to sort contacts
    while (reco1 != NULL) {
        reco2 = reco1->siguiente; // Start comparing with subsequent contacts
        while (reco2 != NULL) {
            if (reco2->info.ID > reco1->info.ID) { // Check for reverse order
                // Swap the contact info if out of order
                contacto aux = reco2->info; // Temporary storage
                reco2->info = reco1->info; // Swap info
                reco1->info = aux; // Restore original info
            }
            reco2 = reco2->siguiente; // Move to the next node
        }
        reco1 = reco1->siguiente; // Move to the next node to sort
    }
}

// Function to capture data for a new contact
void capturadato(contacto &dato) {
    system("cls"); // Clear console for better visibility
    cout << "Datos de contacto: " << endl; // Prompt for user input
    cout << "ID: ";
    cin >> dato.ID; // Read contact ID
    cin.get(); // Clear input buffer
    cout << "RFC: ";
    cin.getline(dato.RFC, 15); // Read RFC
    cout << "Nombre: ";
    cin.getline(dato.nombre, 30); // Read name
    cout << "Apellidos: ";
    cin.getline(dato.apellidos, 30); // Read surname
    cout << "Telefono: ";
    cin.getline(dato.telefono, 15); // Read telephone
    cout << "Celular: ";
    cin.getline(dato.celular, 15); // Read celular
    cout << "Correo electronico: ";
    cin.getline(dato.correo, 50); // Read email
    cout << "Fecha de nacimiento: (DD/MM/AA) ";
    cin.getline(dato.fecha, 15); // Read birth date
}

// Function to print a specific contact's data
void Imprimirdato(contacto dato) {
    cout << "ID: " << dato.ID << endl; // Print contact ID
    cout << "RFC: " << dato.RFC << endl; // Print RFC
    cout << "Nombre: " << dato.nombre << endl; // Print name
    cout << "Apellidos: " << dato.apellidos << endl; // Print surname
    cout << "Telefono: " << dato.telefono << endl; // Print telephone
    cout << "Celular: " << dato.celular << endl; // Print celular
    cout << "Correo electronico: " << dato.correo << endl; // Print email
    cout << "Fecha de nacimiento: " << dato.fecha << endl; // Print birth date
}

// Function to save contacts to a file
void guarda() {
    nodo *reco = raiz; // Start from the head of the linked list
    FILE *archivo; // File pointer
    archivo = fopen("Agenda de contactos.txt", "wt+"); // Open file for writing
    // Write each contact to the file
    while (reco != NULL) {
        fwrite(&reco->info, sizeof(reco->info), 1, archivo); // Write contact info
        reco = reco->siguiente; // Move to next node
    }
    fclose(archivo); // Close the file
}

// Function to read contacts from a file
void Leer() {
    char cadena[30], cadena15[15]; // Temporary char arrays (unused)
    contacto recupera; // Variable to hold extracted contact information
    FILE *archivo; // File pointer
    archivo = fopen("Agenda de contactos.txt", "at+"); // Open file for appending
    // Read each contact from the file and insert into the list
    while (fread(&recupera, sizeof(recupera), 1, archivo) == 1) {
        insertar(1, recupera); // Always insert at position 1 for easier sorting
    }
    fclose(archivo); // Close the file
    ordenamayormenor(); // Sort contacts in descending order by ID after loading
}

// Main menu function for user interaction
void menu() {
    int opc = 0; // Variable to store user option
    while (opc != 9) { // Loop until exit option
        system("cls"); // Clear the console
        cout << "1. Agregar a la agenda" << endl; // Option to add a contact
        cout << "2. Extraer contacto" << endl; // Option to extract a contact
        cout << "3. Borrar contacto" << endl; // Option to delete a contact
        cout << "4. Imprimir la lista" << endl; // Option to print all contacts
        cout << "5. Ordenar de mayor a menor" << endl; // Option to sort contacts
        cout << "6. Ordenar de menor a mayor" << endl; // Option to sort contacts
        cout << "7. Cantidad de contactos" << endl; // Option to show count of contacts
        cout << "8. Mover contactos" << endl; // Option to swap contacts
        cout << "9. Guardar y salir" << endl; // Option to save and exit
        cout << "\n\n\n"; // Extra new lines for spacing
        cout << "Elige una opcion...." << endl; // Prompt for user choice
        cin >> opc; // Read user option
        cin.get(); // Clear input buffer

        switch (opc) {
            case 1: { // Add a contact
                system("cls"); // Clear console
                contacto dato; // Temporary variable for new contact
                int pos; // Variable to store position
                capturadato(dato); // Capture data for the new contact
                cout << "Que posicion desea insertar" << endl;
                cin >> pos; // Get desired position
                insertar(pos, dato); // Insert contact at specified position
                cout << "Contacto agregado." << endl; // Notify user
                cout << "Presione cualquier tecla para continuar"; // Prompt to continue
                cin.get(); // Clear buffer
                break; // Exit case
            }
            case 2: { // Extract a contact
                system("cls"); // Clear console
                int pos; // Variable to store position
                if (vacia() == 1) { // Check if the list is empty
                    cout << "Lista vacia : " << endl; // Notify user
                } else {
                    cout << "El contacto a extraer es: "; // Prompt for position
                    cin >> pos; // Read position
                    cin.get(); // Clear buffer
                    cout << "Extrayendo el contacto : " << endl;
                    Imprimirdato(extraer(pos)); // Extract and print contact information
                }
                cout << "Presione cualquier tecla para continuar"; // Prompt to continue
                cin.get(); // Clear buffer
                break; // Exit case
            }
            case 3: { // Delete a contact
                system("cls"); // Clear console
                int pos; // Variable to store position
                if (vacia() == 1) { // Check if list is empty
                    cout << "Lista vacia : " << endl; // Notify user
                } else {
                    cout << "Posición a borrar: "; // Prompt for position
                    cin >> pos; // Read position
                    cin.get(); // Clear buffer
                    borrar(pos); // Delete contact at specified position
                    cout << "Eliminado \n"; // Notify user
                }
                cout << "Precione cualquier tecla para continuar"; // Prompt to continue
                cin.get(); // Clear buffer
                break; // Exit case
            }
            case 4: { // Print the list of contacts
                system("cls"); // Clear console
                imprimir(); // Print all contacts
                cout << "Presione cualquier tecla para continuar"; // Prompt to continue
                cin.get(); // Clear buffer
                break; // Exit case
            }
            case 5: { // Order contacts from largest to smallest
                system("cls"); // Clear console
                if (vacia() == 1) { // Check if the list is empty
                    cout << "Lista vacia : " << endl; // Notify user
                } else {
                    ordenamenormayor(); // Call sort function
                    cout << "Lista ha sido ordenada \n"; // Notify user
                }
                cout << "Presione cualquier tecla para continuar"; // Prompt to continue
                cin.get(); // Clear buffer
                break; // Exit case
            }
            case 6: { // Order contacts from smallest to largest
                system("cls"); // Clear console
                if (vacia() == 1) { // Check if the list is empty
                    cout << "Lista vacia : " << endl; // Notify user
                } else {
                    ordenamayormenor(); // Call sort function
                    cout << "Lista ordenada\n"; // Notify user
                }
                cout << "Presione cualquier tecla para continuar"; // Prompt to continue
                cin.get(); // Clear buffer
                break; // Exit case
            }
            case 7: { // Show quantity of contacts
                system("cls"); // Clear console
                if (vacia() == 1) { // Check if the list is empty
                    cout << "Lista vacia : " << endl; // Notify user
                } else {
                    cout << "Número de contactos: " << cantidad() << endl; // Show count
                }
                cout << "Presione cualquier tecla para continuar"; // Prompt to continue
                cin.get(); // Clear buffer
                break; // Exit case
            }
            case 8: { // Move (swap) contacts
                system("cls"); // Clear console
                int pos1, pos2; // Variables for positions to be swapped
                if (vacia() == 1) { // Check if the list is empty
                    cout << "1er contacto a intercambiar: "; // Ask for first position
                    cin >> pos1; // Read position
                    cin.get(); // Clear buffer
                    cout << "2do contacto a intercambiar: "; // Ask for second position
                    cin >> pos2; // Read position
                    cin.get(); // Clear buffer
                    intercambiar(pos1, pos2); // Perform swap
                    imprimir(); // Show updated list
                } else {
                    cout << "Lista vacia : " << endl; // Notify user
                }
                cout << "Precione cualquier tecla para continuar"; // Prompt to continue
                cin.get(); // Clear buffer
                break; // Exit case
            }
            case 9: { // Save and exit
                system("cls"); // Clear console
                cout << "Guardando agenda...\n"; // Notify user
                guarda(); // Save all contacts
                cout << "Operación exitosa.\nPresione cualquier tecla para continuar" << endl; // Notify user
                cin.get(); // Clear buffer
                break; // Exit case
            }
            default: { // Handle invalid options
                system("cls"); // Clear console
                cout << "Opción no válida\n"; // Notify user
                cout << "Presione cualquier tecla para continuar"; // Prompt to continue
                cin.get(); // Clear buffer
                break; // Exit case
            }
        }
    }
}

Herramienta: https://products.aspose.ai/total/es/ai-code-analysis/cpp

 73 
 en: 27 Junio 2025, 18:04 pm 
Iniciado por loorezz_ - Último mensaje por Bryantcore
Para elaborar,

Airgeddon es la evolución de LINSET. De hecho, es la evolución de varias herramientas que solían estar en versiones más antiguas de Wifislax, autoría de vk496 y otras personitas (eran españoles, venían de un foro vecino...)

 74 
 en: 27 Junio 2025, 17:15 pm 
Iniciado por El_Andaluz - Último mensaje por MCKSys Argentina
Hola!

He abierto correo con el internet en mi casa y sin tener que poner lo móviles datos para acceder como antes hacía parece que que de momento abre bien, no se si a ti ahora te abre bien.

El tema parece haberse resuelto por sí solo. Ha sido muy raro todo!

Saludos!

 75 
 en: 27 Junio 2025, 11:47 am 
Iniciado por loorezz_ - Último mensaje por loorezz_
Perfecto, gracias

 76 
 en: 27 Junio 2025, 08:16 am 
Iniciado por PanaceR - Último mensaje por PanaceR
hola cree este programa y corre y genera bien el archivo pero no almacena la informacion que se le da

Código:
#include "iostream"
#include "stdlib.h"
#include "fstream"
#include "cstdlib"
using namespace std;

struct contacto{
int ID;
char RFC[15];
char nombre [30];
char apellidos [30];
char telefono [15];
char celular [15];
char correo[50];
char fecha[15];
};

struct nodo{
contacto info;
nodo *siguiente;
};

nodo *raiz=NULL;

int vacia();
int cantidad();
void insertar(int pos, contacto x);
void imprimmir();
contacto extraer(int pos);
void borrar(int pos);
void intercambiar(int pos1, int pos2);
void ordenamenormayor();
void ordenamayormenor();
void menu();
void capturadato(contacto &dato);
void Imprimirdato(contacto dato);
void guarda();
void Leer();

int main(){
Leer();
menu();
return 0;
}

int vacia(){
if(raiz==NULL) return 1;
else return 0;
}
int cantidad(){
nodo *reco=raiz;
int cant=0;
while (reco!=NULL){
reco=reco->siguiente;
cant++;
}
return cant;
}

void insertar(int pos, contacto x){
nodo *nuevo;
nuevo=(nodo*) malloc(sizeof (nodo));
nuevo->info=x;
if (pos<=cantidad()+1){
if(pos==1){
nuevo->siguiente=raiz;
raiz=nuevo;
}
else {
if(pos<=cantidad()+1){
nodo *reco=raiz;
while (reco->siguiente!=NULL){
reco=reco->siguiente;
}
reco->siguiente=nuevo;
nuevo->siguiente=NULL;
}
else{
nodo *reco=raiz;
for (int i=1; i<=pos-2; i++){
reco=reco->siguiente;
}
nodo *sig=reco->siguiente;
reco->siguiente=nuevo;
nuevo->siguiente=sig;
}
}
}else{
nodo*reco=raiz;
while (reco->siguiente!=NULL){
reco=reco->siguiente;
nodo *reco=raiz;
while (reco->siguiente!=NULL){
reco=reco->siguiente;
}
reco->siguiente=nuevo;
nuevo->siguiente=NULL;
}
}
}

void imprimir(){
nodo *reco=raiz;
if (vacia( )==1){
cout<<"Lista esta vacia: "<<endl;
}else{
cout<<"Lista esta completa: "<<endl;
while (reco!=NULL){
Imprimirdato(reco->info);
reco=reco->siguiente;
}
cout<<endl;
}
}

contacto extraer(int pos){
if(pos<=cantidad()){
contacto informacion;
nodo *bor;
if (pos=1){
informacion=raiz->info;
bor=raiz;
raiz=raiz->siguiente;
}
else{
nodo *reco;
reco=raiz;
for (int i=1; i<=pos-2;i++){
reco=reco->siguiente;
}
nodo *prox=reco->siguiente;
reco->siguiente=prox->siguiente;
bor=prox;
}
free(bor);
return informacion;
}
}

void borrar(int pos){
if(pos<=cantidad()){
nodo *bor;
if (pos==1){
bor=raiz;
raiz=raiz->siguiente;
}
else{
nodo*reco;
reco=raiz;
for(int i=1; i<=pos-2; i++){
reco=reco->siguiente;
}
nodo *prox=reco->siguiente;
bor=prox;
}
free(bor);
}
}


void intercambiar(int pos1, int pos2){
if(pos1<=cantidad() && pos2<=cantidad()){
nodo *reco1=raiz;
for(int f=1; f<pos1; f++){
reco1=reco1->siguiente;
}
nodo *reco2=raiz;
for (int f=1; f<pos2;f++){
reco2=reco2->siguiente;
}
contacto aux=reco1->info;
reco1->info=reco2->info;
reco2->info=aux;
}
}

void ordenamenormayor(){
nodo *reco1=raiz;
nodo *reco2;
while(reco1 !=NULL){
reco2=reco1->siguiente;
while (reco2!=NULL){
if(reco2->info.ID<reco1->info.ID){
contacto aux=reco2->info;
reco2->info=reco1->info;
reco1->info=aux;
}
reco2=reco2->siguiente;
}
reco1=reco1->siguiente;
}
}


void ordenamayormenor(){
nodo *reco1=raiz;
nodo *reco2;
while(reco1 !=NULL){
reco2=reco1->siguiente;
while (reco2!=NULL){
if(reco2->info.ID>reco1->info.ID){
contacto aux=reco2->info;
reco2->info=reco1->info;
reco1->info=aux;
}
reco2=reco2->siguiente;
}
reco1=reco1->siguiente;
}
}

void capturadato(contacto &dato){
system("cls");
cout<<"Datos de contacto: "<<endl;
cout<<"ID: ";
cin>>dato.ID;
cin.get();
cout<<"RFC: ";
cin.getline(dato.RFC,15);
cout<<"Nombre: ";
cin.getline(dato.nombre,30);
cout<<"Apellidos: ";
cin.getline(dato.apellidos,30);
cout<<"Telefono: ";
cin.getline(dato.telefono,15);
cout<<"Celular: ";
cin.getline(dato.celular,15);
cout<<"Correoelectronico: ";
cin.getline(dato.correo,50);
cout<<"Fecha de nacimiento: (DD/MM/AA) ";
cin.getline(dato.fecha,15);
}

void Imprimirdato(contacto dato){
cout<<"ID: "<<dato.ID<<endl;
cout<<"RFC: "<<dato.RFC<<endl;
cout<<"Nombre: "<<dato.nombre<<endl;
cout<<"Apellidos: "<<dato.apellidos<<endl;
cout<<"Telefono: "<<dato.telefono<<endl;
cout<<"Celular: "<<dato.celular<<endl;
cout<<"Correo electronico: "<<dato.correo<<endl;
cout<<"Fecha de nacimiento: "<<dato.fecha<<endl;
}

void guarda(){
nodo *reco=raiz;
FILE *archivo;
archivo=fopen("Agenda de contactos.txt","wt+");
while(reco!=NULL){
fwrite(&reco->info, sizeof(reco->info),1,archivo);
reco=reco->siguiente;
}
fclose(archivo);
}

void Leer(){
char cadena[30], cadena15[15];
contacto recupera;
FILE *archivo;
archivo=fopen("Agenda de contactos.txt","at+");
while (fread(&recupera,sizeof(recupera),1,archivo)==1){
insertar(1,recupera);
}
fclose(archivo);
ordenamayormenor();
}

void menu(){
int opc=0;
while(opc !=9){
system ("cls");
cout<<"1. Agregar a la agenda"<<endl;
cout<<"2. Extraer contacto"<<endl;
cout<<"3. Borrar contacto"<<endl;
cout<<"4. Imprimir la lista"<<endl;
cout<<"5. Ordenar de mayor a menor"<<endl;
cout<<"6. Ordenar de menor a mayor"<<endl;
cout<<"7. Cantidad de contactos"<<endl;
cout<<"8. Mover contactos"<<endl;
cout<<"9. Guardar y salir"<<endl;
cout<<"\n \n \n";
cout<<"Elige una opcion...."<<endl;
cin>>opc;
cin.get();
switch(opc){
case 1:
system ("cls");
contacto dato;
int pos;
capturadato(dato);
cout<<"que pocision desea insertar"<<endl;
case 2:{
system("cls");
int pos;
if (vacia()==1){
cout<<" lista vacia : "<<endl;
}else{
cout<<"el contacto a extraer es: ";
cin>>pos;
cin.get();
cout<<"extrayendo el contacto: "<<endl;
Imprimirdato(extraer(pos));
}
cout<<"Presione cualquier tecla para continuar";
cin.get();
break;
}
case 3:{
system("cls");
int pos;
if (vacia()==1){
cout<<" Lista vacia : "<<endl;
}else{
cout<<"posicion a borrar: ";
cin>>pos;
cin.get();
borrar(pos);
cout<<"eliminado \n";
}
cout<<"Precione cualquier tecla para continuar";
cin.get();
break;
}
case 4:{
system("cls");
imprimir();
cout<<"Presione cualquier tecla para continuar";
cin.get();
break;
}
case 5:{
system("cls");
if(vacia()==1){
cout<<" lista vacia : "<<endl;
}else{
ordenamenormayor();
cout<<"lista a sido ordenada \n";
}
cout<<"Presione cualquier tecla para continuar";
cin.get();
break;
}
case 6:{
system("cls");
if(vacia()==1){
cout<<" lista vacia : "<<endl;
}else{
ordenamayormenor();
cout<<"lista ordenada\n";
}
cout<<"Presione cualquier tecla para continuar";
cin.get();
break;
}
case 7:{
system("cls");
if(vacia()==1){
cout<<"lista vacia : "<<endl;
}else{
cout<<"no de contactos: "<<cantidad()<<endl;
}
cout<<"Presione cualquier tecla para continuar";
cin.get();
break;
}
case 8:{
system("cls");
int pos1, pos2;
if(vacia()==1){
cout<<" 1er contacto a intercambiar: ";
cin>>pos1;
cin.get();
cout<<"2do contacto a intercambiar: ";
cin>>pos2;
cin.get();
intercambiar(pos1, pos2);
imprimir();
}
cout<<"Precione cualquier tecla para continuar";
cin.get();
break;
}
case 9:{
system("cls");
cout<<"Guardando agenda...\n";
guarda();
cout<<"Operacion existosa.\nPresione cualquier tecla para continuar"<<endl;
cin.get();
break;
}
default:{
system("cls");
cout<<"Opcion no valida\n";
cout<<"Presione cualquier tecla para continuar";
break;
}
}
}
}

 77 
 en: 27 Junio 2025, 04:01 am 
Iniciado por Eleкtro - Último mensaje por Tachikomaia
Podrías crearte otra cuenta para averiguar ese tipo de cosas. O pedirle a algún conocido que te ayude a hacer el experimento. Luego nos cuentas.

Yo tengo una duda similar con Facebook: No sé si las sugerencias de amistad son algo que aparece automáticamente cuando visitas o visitan tu perfil o si FB detecta simitud de gustos... o si son algo enviado.

 78 
 en: 27 Junio 2025, 01:50 am 
Iniciado por Eleкtro - Último mensaje por Eleкtro
Tengo una duda general sobre Telegram.

Si estoy chateando con alguien y después de unos 30 minutos reviso el chat y me aparece el mensaje "Visto por última vez hace mucho tiempo" como se muestra en esta imagen:



Y además ya no me aparece su foto de perfil / avatar…

¿Eso significa que esa persona me ha bloqueado?.

Pero a esa persona yo todavía puedo enviarle mensajes, y Telegram no me muestra ninguna notificación que me indique que me han bloqueado. Por eso me resulta confuso, y quería saber si realmente eso es señal de un bloqueo.

Quizás la pregunta que en realidad debería hacer sea: ¿cuando una persona te bloquea en Telegram puedes seguir enviándole mensajes? (aunque obviamente, en caso de ser así, esos mensajes no los recibirá)

Atentamente,
Elektro.

 79 
 en: 26 Junio 2025, 15:55 pm 
Iniciado por Huzzah - Último mensaje por EdePC
Primero debes haber cumplido la indicación 2 del readme.txt de "C:\borland\bcc55\readme.txt"

Citar
2. From the bin directory of your installation:
   a. Add "c:\Borland\Bcc55"
      to the existing path
   b. Create a bcc32.cfg file which will set
      the compiler options for the Include
      and Lib paths (-I and -L switches to
      compiler) by adding these lines:
      -I"c:\Borland\Bcc55\include"
      -L"c:\Borland\Bcc55\lib"
   c. Create an ilink32.cfg file which will set
      the linker option for the Lib path by
      adding this line:
      -L"c:\Borland\Bcc55\lib"

Tengo entendido que el paso "a" ya lo hiciste, aunque lo que se tiene que agregar al PATH es C:\borland\bcc55\bin , el paso "b" pide crear el archivo "C:\borland\bcc55\bcc32.cfg" con contenido:

Citar
-I"c:\Borland\Bcc55\include"
-L"c:\Borland\Bcc55\lib"

Ahora toca abrir Geany (cerrar y volver a abrir si ya lo tenias abierto), ir al menú "Construir" > "Establecer comandos de construcción", solo hay que cambiar el primer cuadrito que dice: gcc -wall -c "%f" por: bcc32 "%f", das en Aceptar y ya está.

Para compilar tu código te vas al menú Construir > Compile (F8), y para ejecutarlo vas a Construir > Execute (F5). Necesitas hacer ambos pasos para ver los resultados.

 80 
 en: 26 Junio 2025, 09:42 am 
Iniciado por Huzzah - Último mensaje por Huzzah
he puesto las carpetas en variable de entorno
c:\borland\bc55\bin
pero no se que parametro poner en geany
gracias por su respuesta

Páginas: 1 2 3 4 5 6 7 [8] 9 10
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines