Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/02/2009, 12:15
Tikitios
 
Fecha de Ingreso: mayo-2008
Ubicación: Chile
Mensajes: 189
Antigüedad: 16 años
Puntos: 3
Pasar de String a INT

gracias a los consejos de peterpay y MeduZaPat logre hacer esto:
Cita:
#include <iostream>
#include <string>
#include <sstream>

using namespace std;

int main()
{
// De String a Int
string string1 = ("43");
stringstream buffer(string1);
int x;
buffer >> x;
x = x*5;
cout << x << endl;

// De Int a String
int y = 5;
stringstream buffer2;
buffer2 << y;
string string2 = buffer2.str();
string2 += (" es el numero.");
cout << string2 << endl;

system("PAUSE");
return 0;
}

Última edición por Tikitios; 27/02/2009 a las 09:16