Examveda

What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
int main ()
{
  std::string str ("Example.");
  str.back() = '!';
  std::cout << str << endl;
  return 0;
}

A. Example.!

B. Example.

C. Example!

D. Example!.

Answer: Option C


Join The Discussion

Related Questions on Classes and Objects in C plus plus