why iam unable to concatenate the string here?

You have missed adding including string. Also declaration for d variable was not correct. Could you please try with below code.

#include <iostream>
#include <limits>
#include<string>


int main()
{
  int i = 4;
  double d = 4.0;
  std::string s = "HackerRank";

int a;
double b;
std::string c;                          

std::cin >> a; 
std::cin >> b;
std::cin >> c;


a = a + i;
b = b + d;


std::cout << a << std::endl;
std::cout << b << std::endl;
std::cout << "" + s + c;

return 0;
}

Leave a Comment