How does one use an if else statement to replace the vowels in a string?
given a string s = "instruction"
how can one replace:
i with e
u with a
o with i
using an if else statement
here is my attempt:
given a string s = "instruction"
how can one replace:
i with e
u with a
o with i
using an if else statement
here is my attempt:
C#:
[FONT=Consolas] [COLOR=#444444][/COLOR][COLOR=#009695]class[/COLOR][COLOR=#444444] [/COLOR][COLOR=#3364a4]MainClass[/COLOR]
[COLOR=#444444] [/COLOR][COLOR=#444444]{[/COLOR]
[COLOR=#444444] [/COLOR][COLOR=#009695]public[/COLOR][COLOR=#444444] [/COLOR][COLOR=#009695]static[/COLOR][COLOR=#444444] [/COLOR][COLOR=#009695]void[/COLOR][COLOR=#444444] [/COLOR][COLOR=#444444]Main[/COLOR][COLOR=#444444] [/COLOR][COLOR=#444444]([/COLOR][COLOR=#009695]string[/COLOR][COLOR=#444444][][/COLOR][COLOR=#444444] [/COLOR][COLOR=#444444]args[/COLOR][COLOR=#444444])[/COLOR]
[COLOR=#444444] [/COLOR][COLOR=#444444]{[/COLOR]
[COLOR=#444444] [/COLOR][COLOR=#009695]string[/COLOR][COLOR=#444444] [/COLOR][COLOR=#444444]s = "instructor's Manual"[/COLOR][COLOR=#444444];[/COLOR][/FONT]
[FONT=Consolas] [COLOR=#444444][/COLOR][COLOR=#009695] for[/COLOR][COLOR=#444444]([/COLOR][COLOR=#009695]int[/COLOR][COLOR=#444444] [/COLOR][COLOR=#444444]i[/COLOR][COLOR=#444444] [/COLOR][COLOR=#444444]=[/COLOR][COLOR=#444444] [/COLOR][COLOR=#f57d00]0[/COLOR][COLOR=#444444];[/COLOR][COLOR=#444444] [/COLOR][COLOR=#444444]i[/COLOR][COLOR=#444444] [/COLOR][COLOR=#444444]<[/COLOR][COLOR=#444444] [/COLOR][COLOR=#444444]s[/COLOR][COLOR=#444444].[/COLOR][COLOR=#444444]Length[/COLOR][COLOR=#444444];[/COLOR][COLOR=#444444] [/COLOR][COLOR=#444444]i[/COLOR][COLOR=#444444]++[/COLOR][COLOR=#444444])[/COLOR]
[COLOR=#444444] [/COLOR][COLOR=#444444]{[/COLOR][/FONT][FONT=Consolas] [COLOR=#444444][/COLOR][COLOR=#009695]if[/COLOR][COLOR=#444444] [/COLOR][COLOR=#444444]([/COLOR][COLOR=#444444]s[/COLOR][COLOR=#444444][[/COLOR][COLOR=#444444]i[/COLOR][COLOR=#444444]][/COLOR][COLOR=#444444] [/COLOR][COLOR=#444444]==[/COLOR][COLOR=#444444] [/COLOR][COLOR=#f57d00]'[/COLOR][COLOR=#f57d00]i[/COLOR][COLOR=#f57d00]'[/COLOR][COLOR=#444444])[/COLOR][COLOR=#444444] [/COLOR]
[COLOR=#444444] [/COLOR][COLOR=#444444]{[/COLOR]
[COLOR=#444444] [/COLOR][COLOR=#3364a4]Console[/COLOR][COLOR=#444444].[/COLOR][COLOR=#444444]Write[/COLOR][COLOR=#444444] [/COLOR][COLOR=#444444]([/COLOR][COLOR=#f57d00]"[/COLOR][COLOR=#f57d00]e[/COLOR][COLOR=#f57d00]"[/COLOR][COLOR=#444444])[/COLOR][COLOR=#444444];[/COLOR]
[COLOR=#444444] [/COLOR][COLOR=#444444]}[/COLOR][COLOR=#444444]
[/COLOR][COLOR=#009695] else[/COLOR][COLOR=#444444] if([/COLOR][/FONT][FONT=Consolas][COLOR=#444444][/COLOR][COLOR=#444444]s[/COLOR][COLOR=#444444][[/COLOR][COLOR=#444444]i[/COLOR][COLOR=#444444]][/COLOR][COLOR=#444444] [/COLOR][COLOR=#444444]==[/COLOR][COLOR=#444444] [/COLOR][COLOR=#f57d00]'[/COLOR][COLOR=#f57d00]u[/COLOR][COLOR=#f57d00]'[/COLOR][/FONT][FONT=Consolas][COLOR=#444444])
{
[/COLOR][/FONT]
[FONT=Consolas][COLOR=#3364a4] Console[/COLOR][COLOR=#444444].[/COLOR][COLOR=#444444]Write[/COLOR][COLOR=#444444] [/COLOR][COLOR=#444444]([/COLOR][COLOR=#f57d00]"[/COLOR][COLOR=#f57d00]a[/COLOR][COLOR=#f57d00]"[/COLOR][COLOR=#444444])[/COLOR][COLOR=#444444];[/COLOR][/FONT][FONT=Consolas][COLOR=#444444]
}
[/COLOR][/FONT][FONT=Consolas][COLOR=#009695]else[/COLOR][COLOR=#444444] if([/COLOR][/FONT][FONT=Consolas][COLOR=#444444][/COLOR][COLOR=#444444]s[/COLOR][COLOR=#444444][[/COLOR][COLOR=#444444]i[/COLOR][COLOR=#444444]][/COLOR][COLOR=#444444] [/COLOR][COLOR=#444444]==[/COLOR][COLOR=#444444] [/COLOR][COLOR=#f57d00]'o[/COLOR][COLOR=#f57d00][/COLOR][COLOR=#f57d00]'[/COLOR][/FONT][FONT=Consolas][COLOR=#444444])
{
[/COLOR][/FONT]
[FONT=Consolas][COLOR=#3364a4] Console[/COLOR][COLOR=#444444].[/COLOR][COLOR=#444444]Write[/COLOR][COLOR=#444444] [/COLOR][COLOR=#444444]([/COLOR][COLOR=#f57d00]"i[/COLOR][COLOR=#f57d00][/COLOR][COLOR=#f57d00]"[/COLOR][COLOR=#444444])[/COLOR][COLOR=#444444];[/COLOR][/FONT][FONT=Consolas][COLOR=#444444]
}[/COLOR][/FONT][FONT=Consolas]
[/FONT]
[FONT=Consolas][COLOR=#444444][/COLOR][/FONT][FONT=Consolas][COLOR=#009695] else[/COLOR][COLOR=#444444] [/COLOR][/FONT][FONT=Consolas][COLOR=#444444]
[/COLOR][COLOR=#444444]{[/COLOR]
[COLOR=#444444] [/COLOR][COLOR=#999988][I][/I][/COLOR]
[COLOR=#444444] [/COLOR][COLOR=#3364a4]Console[/COLOR][COLOR=#444444].[/COLOR][COLOR=#444444]Write[/COLOR][COLOR=#444444] [/COLOR][COLOR=#444444]([/COLOR][COLOR=#444444][/COLOR][COLOR=#444444]s[/COLOR][COLOR=#444444][[/COLOR][COLOR=#444444]i[/COLOR][COLOR=#444444]])[/COLOR][COLOR=#444444];[/COLOR]
[COLOR=#444444] [/COLOR][COLOR=#444444]}
}[/COLOR][/FONT]