+ 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

5th Sep 2018, 2:57 PM
jeevan
jeevan - avatar
4 Answers
+ 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; }
5th Sep 2018, 7:05 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 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
5th Sep 2018, 3:07 PM
Manual
Manual - avatar
+ 2
tq @ nAutAxH
6th Sep 2018, 1:58 AM
jeevan
jeevan - avatar
+ 1
@manual i already tried this...but i am not getting the output...if you know how to write code please share or else .......
5th Sep 2018, 3:18 PM
jeevan
jeevan - avatar