Examveda

What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
int main ()
{
    string str ("Microsoft");
    for (size_t i = 0; i < str.length();)
    {
        cout << str.at(i-1);
    }
    return 0;
}

A. M

B. Microsoft

C. Micro

D. runtime error

Answer: Option D


Join The Discussion

Related Questions on Classes and Objects in C plus plus