0

How to solve this question without switch case:

Input Format: A string of your message in its normal form. Output Format: A string of your message once you have encoded it (all lower case). Sample Input: Hello World Sample Output: svool dliow

20th May 2021, 1:56 PM
𝗣𝗮𝘄𝗮𝗻 𝗞𝘂𝗺𝗮𝗿 🅟︎🅚︎
𝗣𝗮𝘄𝗮𝗻 𝗞𝘂𝗺𝗮𝗿 🅟︎🅚︎ - avatar
9 Antworten
+ 1
Just use ascii values for this Assume you get a character c Convert it to lowercase using tolower ('z'-97) -(c-97) +97 to get corresponding charactwr
20th May 2021, 2:08 PM
YUGRAJ
0
what are the rules of encoding?
20th May 2021, 2:00 PM
visph
visph - avatar
0
You have to enter a word than print it backwards. For example a=z,b=y, But without switch case
20th May 2021, 2:03 PM
𝗣𝗮𝘄𝗮𝗻 𝗞𝘂𝗺𝗮𝗿 🅟︎🅚︎
𝗣𝗮𝘄𝗮𝗻 𝗞𝘂𝗺𝗮𝗿 🅟︎🅚︎ - avatar
0
well, so convert first input to lower case, then get the char code of each letter wich you substract the char code of 'a' (this give you a number in range 0..25 both included), then compute 25-number (this give you the encoded range) to wich you add the char code of 'a' (this give you the char code of the encoded letter) and finally convert it to a char ^^
20th May 2021, 2:11 PM
visph
visph - avatar
0
formula of YUGRAJ is valid for c/c++, for javascript you must convert char to char code before and do the result backward to a char... only for letters ^^
20th May 2021, 2:13 PM
visph
visph - avatar
0
I am thinking this question long time but no idea how to solve. Anyone can solve it.
20th May 2021, 4:04 PM
𝗣𝗮𝘄𝗮𝗻 𝗞𝘂𝗺𝗮𝗿 🅟︎🅚︎
𝗣𝗮𝘄𝗮𝗻 𝗞𝘂𝗺𝗮𝗿 🅟︎🅚︎ - avatar
0
Thanks brother
20th May 2021, 4:23 PM
𝗣𝗮𝘄𝗮𝗻 𝗞𝘂𝗺𝗮𝗿 🅟︎🅚︎
𝗣𝗮𝘄𝗮𝗻 𝗞𝘂𝗺𝗮𝗿 🅟︎🅚︎ - avatar
0
that's just the implementation of what I previously explained ^^
20th May 2021, 4:24 PM
visph
visph - avatar