473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Shift a string by receiving a string converting it to ascii and then shifting it and

SMy instructor gave me a psuedocode but I'm still stuck.
get a char
while not end of input:
change char so it's 0-25
shift it forward the appropriate value
"normalize" it so it's still 0-25
change char back to a letter by adding 'a' to it
print it
get next char
end while

Basically if you were to input hello should get out uryyb because it shifted over 13 places. If someone could explain how I should approach this I would be forever greatful.
}
Jul 2 '16 #1
1 1151
weaknessforcats
9,208 Expert Mod 8TB
Look at the ASCII table.

There an A is 65. To make the A a B you just add 1 to make it 66.

All char variables will display the symbol rather than the integer value.

in your case you just add 13 to H and you are done.

Please note this works only for values in the ASCII table in the range 32-126. That is, the displayable characters.
Jul 2 '16 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: J. Oliver | last post by:
I am attempting to copy a portion of a string into another string. Say I have "abcdef" in string 'a' and want to copy only "bcd" into a new string 'b'. The following function came to mind: ...
5
by: Mark | last post by:
Is int to Int32 as string is to String? If that's the case, then the following is logically equivalent: //equivalent int MyInt = 5000; Int32 MyInt2 = 5000; //equivalent string MyString =...
11
by: Kai Bohli | last post by:
Hi all ! I need to translate a string to Ascii and return a string again. The code below dosen't work for Ascii (Superset) codes above 127. Any help are greatly appreciated. protected...
8
by: Dan | last post by:
In C#, how would you loop through each character in a string and convert them to their ascii values?
5
by: Ioannis Vranos | last post by:
When we assign a managed or unmanaged string literal to a String *, is a new String created implicitly in the managed heap? Or in other words, what happens when we assign a string literal to...
6
by: Bruce Wiebe | last post by:
Hi all I have a string that contains a list of email addresses in the format {"X@y.com","x@y.com"} and i need to convert it to a string array in the same format so my array would loook like ...
4
by: ThunderMusic | last post by:
Hi, I have to go from Byte() to String, do some processing then reconvert the String to byte() but using ascii format, not unicode. I currently use a stream to write the char()...
22
by: Terry Olsen | last post by:
I have an app that makes decisions based on string content. I need to make sure that a string does not contain only spaces or newlines. I am using the syntax 'Trim(String)" and it works fine. I...
5
by: peter | last post by:
Hello all, I'm looking for an advice. Example (one block in ascii file): $------------------------ NAME='ALFA' CODE='x' $------------------------
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.