You can always use to_string()
method:
#include
#include
using namespace std;
int main() {
string s;
int ipAddress[] = {127, 0, 0, 1};
for(int i = 0; i < 4; ++i) {
s += to_string(ipAddress[i]);
if(i != 4 - 1)
s += '.';
}
cout << s << endl;
}
This will solve your problem