Q. What will be the output of the following C++ code?

Code:
        #include <iostream>

        #include <string>

        #include <algorithm>

        using namespace std;

        int main() 

        {

            string s = "Hello World";

            s.erase(remove(s.begin(), s.end(), ' ' ), s.end() ) ;

            cout << s << endl;

        }
  • (A) HelloWorld
  • (B) Hello World
  • (C) World
  • (D) Hello
πŸ’¬ Discuss
βœ… Correct Answer: (A) HelloWorld

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
218
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Babita
Publisher
πŸ“ˆ
99%
Success Rate