+ 1
Write a program to replace consonant in a string with special character (#)...plz
if the string is sololearn123 then the replaced output will be #o#o#ea##123
4 Réponses
+ 7
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main()
{
string str = "SoloLearn123";
for(int i = 0; i < str.size(); i++)
{
if(isalpha(str[i]))
{
if(!(str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u' || str[i] == 'A' || str[i] == 'E' || str[i] == 'I' || str[i] == 'O' || str[i] == 'U'))
{
str[i] = '#';
}
}
}
cout << str << endl;
return 0;
}
+ 2
jeevan
You need to show you tried with code.
This is a self-help platform not one where users are asked to do all the work
+ 2
tq @ nAutAxH
+ 1
@manual i already tried this...but i am not getting the output...if you know how to write code please share or else .......