Need a project done?

C++ Programming Developer

Search This Blog

Convert int to string C++

Convert int to string in C++. Following program converts an int to string in C++.
#include <iostream>
#include <string>
#include <sstream>

using namespace std;

string int_to_string(const int& port) {
    stringstream ss;
    ss << port;
    return ss.str();
}

int main() {
    int port = 114;
    cout << int_to_string(port) << endl;
}
"Don't let anyone ever make you feel like you don't deserve what you want."