Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program Using C. Create a program called encode.c. Mike has been passing notes in class without a problem until his teacher intercepted one day. In

Program Using C.

Create a program called encode.c. Mike has been passing notes in class without a problem until his teacher intercepted one day. In order to prevent future embarrassment, he wants a way to encode his notes so his teacher cannot read them. Write a program that encodes a sentence by switching every alphabetical letter (lower case or upper case) with alphabetical position i with the letter with alphabetical position 25 i. For example, letter a is at position 0 and after encoding it becomes letter z (position 25). Letter m is at position 12, it becomes letter n (25 12 = 13) after encoding.

Input: Meet me at the cafeteria

Output: Nvvg nv zg gsv xzuvgvirz

Your program should include the following function:

void encode(char *s1, char *s2);

The function expects s1 to point to a string containing the input as a string and stores the output to the string pointed by s2.

1) Assume input is no longer than 1000 characters.

2) The encode function should use pointer arithmetic (instead of array subscripting). In other words, eliminate the loop index variables and all use of the [] operator in the function.

3) To read a line of text, use the read_line function (the pointer version) in the lecture notes.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Inference Control In Statistical Databases From Theory To Practice Lncs 2316

Authors: Josep Domingo-Ferrer

2002nd Edition

3540436146, 978-3540436140

More Books

Students also viewed these Databases questions

Question

1. What is Ebola ? 2.Heart is a muscle? 3. Artificial lighting?

Answered: 1 week ago

Question

2. What process will you put in place to address conflicts?

Answered: 1 week ago