How does addition happened without initializing i2 or taking value from user?

  add, c++, cin, compiler-construction, sum

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

 int i2;
 double d2;
 string s2;

 cin>>i2;
 cin>>d2;

 //cin.ignore();
 getline(cin>>ws, s2);

 cout<<i2+i<<endl;
 cout.precision(1);
 cout << fixed << d+d2 << endl;
 cout<<s+s2;

 return 0;

}

Source: Windows Questions C++

LEAVE A COMMENT