06.05.2013 Views

CONTENIDO DE LA LECCIÓN 8

CONTENIDO DE LA LECCIÓN 8

CONTENIDO DE LA LECCIÓN 8

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

MIGUEL Á. TOLEDO MARTÍNEZ<br />

Un tercer método es emplear el manipulador de E/S ws (espacio en blanco – whitespace) para<br />

leer cualquier espacio en blanco antes de getline() El manejador ws extrae cualquier espacio en<br />

blanco que haya quedado en la memoria temporal de entrada. Para usarlo, simplemente coloque<br />

en su programa un enunciado cin >> ws antes del enunciado cin.getline.<br />

Ejemplo 7.17<br />

// Definición de variables de entrada<br />

int numero = 0;<br />

char temporal[2] = "\0";<br />

char nombre[TAMANO] = "\0";<br />

// Pregunta al usuario y lee/muestra los datos ingresados<br />

cout > numero;<br />

cout

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!