get started with the encoding program, start a new project and declare a character array that contains all 26 letters of the alphabet: 115.P2 4 char alpha[26] = {'A','B','C','D','E','F','G','H', etc. ','T','U','V','W','X','Y','Z'}; To display this to the screen, one option is to use a simple for loop as follows: for (n=0; n<26; n++) { printf("%c ", alpha[n]); } printf("\n"); Test this part of your

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

To get started with the encoding program, start a new project and declare a character array that
contains all 26 letters of the alphabet:
115.P2
4
char alpha[26] = {'A','B','C','D','E','F','G','H', etc. ','T','U','V','W','X','Y','Z'};
To display this to the screen, one option is to use a simple for loop as follows:
for (n=0; n<26; n++) {
printf("%c ", alpha[n]);
}
printf("\n");
Test this part of your program. You should then create a second array that will contain the
equivalent letters during encryption, and display both arrays to the screen. For an offset of 3
characters, the output of your program should be equivalent to the table on page 1 of these
notes. You should declare an integer to represent the key and use scanf_s as usual to obtain its
value from the user. The output of your program should look something like Figure 3.3 below.
The top array contains all the characters of the alphabet, and the bottom array contains the
encrypted version.

An important challenge here is that there are three characters (A, B and C) where their
encrypted versions are the last three letters of the alphabet (X, Y and Z). Think about how you
can generate the second array. One way of doing this is by moving the letters of the first array
by three to the right. This will in turn create three empty spaces at the start of the second array
which you must then fill. Your code should work for any key and not only for the example
considered in Figure 3.3.
No new programing concepts are required. You should be able to complete this part of the
exercise using the arrays and for loops from Laboratory 1 – although partly an exercise in C
programing it is also an exercise in logical thinking!
Build your program step by step and test it as you go. If you run into problems compiling your
program, you may find it useful to return to an earlier version and then to add one new line or
segment of code at a time, to determine if this is the problem. For example, it makes good
sense to first write a program to simply generate and display the 26 letter alphabet (as already
suggested above).

. C:\windows\system32\cmd.exe
Enter key: 3
A B C DÉ F GHI J K L MNOP Q R S TU U W x Y Z
X Y ZA BCDEF GHI J KL M NO P QR S TÜ U W
Press any key to continue
Figure 3.3 Output from the alphabet shift program.
Transcribed Image Text:. C:\windows\system32\cmd.exe Enter key: 3 A B C DÉ F GHI J K L MNOP Q R S TU U W x Y Z X Y ZA BCDEF GHI J KL M NO P QR S TÜ U W Press any key to continue Figure 3.3 Output from the alphabet shift program.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY