Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

// Global Macro Values. They are used to define the size of 2D array of characters #define NUM_STRINGS 4 #define STRING_LENGTH 50 // Forward Declarations

// Global Macro Values. They are used to define the size of 2D array of

characters

#define NUM_STRINGS 4

#define STRING_LENGTH 50

// Forward Declarations

void initializeStrings(char[NUM_STRINGS][STRING_LENGTH]);

void printStrings(char[NUM_STRINGS][STRING_LENGTH]);

void reverseStrings(char strings[NUM_STRINGS][STRING_LENGTH]);

void encryptStrings(char[NUM_STRINGS][STRING_LENGTH], int);

void decryptStrings(char[NUM_STRINGS][STRING_LENGTH], int);

int splitAndPrintSentences(char s[NUM_STRINGS*STRING_LENGTH]);

void inputMatrix(int matrixA[3][3]);

void determinant(int matrixA[3][3]);

// Problem 3: reverseString (5 points)

// Reverse each string of strings[][].

// Consider one string at a time and reverse the characters. For instance,

"hi hello" should reverse to "olleh ih".

void reverseStrings(char strings[NUM_STRINGS][STRING_LENGTH])

{

}

// Problem 4: encryptStrings (5 points)

// Traverse the 2D character array 'strings' and encrypt each string in 2

steps as follows-

// 1) Reverse the string.

// Hint: Use 'reverseStrings()' for this step.

// 2) Then shift those ASCII characters forward by the integer value of

'key'.

// If the string is "hello" and key = 2, reversing will get you "olleh"

and adding key to it will result in "qnnfj"

// If the value of 'key' is large, you will extend past the alphabetical

characters and reach non-alphabetical characters. Thats ok.

// NOTE: DO NOT encrypt the null terminator character. Use the null

terminator '\0' to find the end string.

// *** NOTE: If you were unable to code for reverseStrings(), then skip

that step in this function and simply shift the characters ahead by 'key'.

// While decrypting in the next function, you will again

have to skip the reversing part. You will get partial points in that case.

void encryptStrings(char strings[NUM_STRINGS][STRING_LENGTH], int key)

{

}

// Problem 5: decryptStrings (5 points)

// HINT: This should be very similiar to the encryption function defined

above.

// Traverse the 2D character array 'strings' and decrypt each string in 2

steps as follows-

// 1) Shift those ASCII characters backward by the integer value of 'key'.

// 2) Then reverse the string.

// Hint: Use 'reverseStrings()' for this step.

// *** NOTE: If you were unable to code for reverseStrings(), then skip

that step in this function and simply shift the characters backward by

'key'.

// You will get partial points in that case.

void decryptStrings(char strings[NUM_STRINGS][STRING_LENGTH], int key)

{

}

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

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions