What will be the output of the following C++ code if the string entered by the user is "Hello World"?
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char const *argv[])
{
string str;
cin>>str;
cout<<str;
return 0;
}
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char const *argv[])
{
string str;
cin>>str;
cout<<str;
return 0;
}A. Hello World
B. Hello
C. World
D. Error
Answer: Option B

Join The Discussion