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

 

 


Tema destacado: Únete al Grupo Steam elhacker.NET


  Mostrar Temas
Páginas: [1]
1  Programación / Programación C/C++ / Ayuda leer cadenas y guardarlas en una sola variable en: 20 Noviembre 2014, 01:54 am
Estoy haciendo un programa con estructuras y a la hora de querer guardar un nombre cuando se ingresar un espacio lo guarda en la siguiente variable 



Código:
#include <iostream>
#include<windows.h>

using namespace std;

struct cliente {
char nombre[];
int telefono;
char domicilio[];
char articulo[15];
char marca[10];
char modelo[10];
char numser[25];
char dano[];

cliente *next;
};

void insertar(void)
{
    cliente *nuevo = new (cliente);

if (nuevo == NULL )
    cout << "No hay memoria suficiente" << endl;
else{
cout << "Nombre del cliente: " ;
cin >> nuevo ->nombre;
cout << "Telefono: " ;
cin >> nuevo->telefono;
cout << "Domicilio: " ;
cin >> nuevo->domicilio;
cout << "Articulo: " ;
cin >> nuevo->articulo;
cout << "Marca: " ;
cin >> nuevo->marca;
cout << "Modelo: " ;
cin >> nuevo->modelo;
cout << "Numero de Serie: " ;
cin >> nuevo->numser;
cout << "Dano reportado: " ;
cin >> nuevo->dano;
nuevo -> next = NULL;
}

if(LISTA ==NULL){
LISTA = nuevo;
} else {
cliente *tempo = LISTA;
while( tempo->next != NULL)
tempo= tempo -> next;
tempo->next = nuevo;

}
}
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines