-
What is the output of this program?
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string s ("Ajit Kumar");
unsigned found = s.find_first_of("Gupta");
while (found != string :: npos)
{
s[found] = '*';
found = s.find_first_of("Gupta", found + 1);
}
cout << s << '\n';
return 0;
}
-
- Ajit Kumar
- Gupta
- Compilation Error
- Runtime Error
- Segmentation fault
Correct Option: E
In this program, We are replacing the vowels with a asterisk by using find_first_of method.