Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created April 15, 2021 13:15
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/7862c7f0e29ceaa3775025ae97a3a47b to your computer and use it in GitHub Desktop.
Save parzibyte/7862c7f0e29ceaa3775025ae97a3a47b 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
getline(input_stringstream, nombre, ';');
getline(input_stringstream, apellido, ';');
getline(input_stringstream, correo, ';');
getline(input_stringstream, paginaWeb, ';');
// 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