Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created April 15, 2021 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/38ccf705f38b0864f952ccbad0488170 to your computer and use it in GitHub Desktop.
Save parzibyte/38ccf705f38b0864f952ccbad0488170 to your computer and use it in GitHub Desktop.
/*
https://parzibyte.me/blog
*/
#include <iostream>
#include <sstream>
using namespace std;
int main()
{
string cadena = "Luis Cabrera luis@ejemplo.com parzibyte.me"; // Nombre Apellido correo página web
stringstream input_stringstream(cadena); // Convertir la cadena a un stream
string nombre, apellido, correo, paginaWeb;
// Extraer
char delimitador =' ';
getline(input_stringstream, nombre, delimitador);
getline(input_stringstream, apellido, delimitador);
getline(input_stringstream, correo, delimitador);
getline(input_stringstream, paginaWeb, delimitador);
// Imprimir
cout << "Nombre: " << nombre << endl;
cout << "Apellido: " << apellido << endl;
cout << "Correo: " << correo << endl;
cout << "Web: " << paginaWeb << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment