-
What is the output of this program?
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string str ("Testing str...");
for ( string :: iterator Iter = str.begin(); Iter != 5; ++Iter)
cout << *Iter;
return 0;
}
-
- Compilation Error
- Testing str...
- Runtime Error
- Garbage value
- None of these
Correct Option: A
In the for loop, We are not allowed to give a numeric value in string, So it is arising an error.