Difference: Lab8 (1 vs. 5)

Revision 52015-11-10 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 8

Due: Nov 13, 11:55pm

Line: 43 to 43
 

Problem 2

Changed:
<
<
Write a sorting function that is similar to Display 7.12 in Chapter 7 except that it has an argument for a vector of ints rather than an array. This function will not need a parameter like number_used as in Display 7.12, since a vector can determine the number used with the member function size(). This sort function will have only this one parameter, which will be of a vec- tor type. Use the selection sort algorithm (which was used in Display 7.12).
>
>
Write a sorting function that is similar to Display 7.12 in Chapter 7 except that it has an argument for a vector of ints rather than an array. This function will not need a parameter like number_used as in Display 7.12, since a vector can determine the number used with the member function size(). This sort function will have only this one parameter, which will be of a vector type. Use the selection sort algorithm (which was used in Display 7.12).
  Sort the following lists and turn in:

Revision 42015-11-10 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 8

Changed:
<
<

Due: Nov 12, 11:55pm

>
>

Due: Nov 13, 11:55pm

 

Instructions

  • Turn in the code (a cpp file or ideone.com link), and the run outputs as requested below.
  • Remember to format the code as described and the book and text, and to include comments including complete commetns at the beginning of the program.

Revision 32015-11-01 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Lab 8

Due: Nov 12, 11:55pm

Line: 41 to 40
 Consequently, “Hey” would be transmitted as “Ro$.”

Write a program that decrypts the intercepted message. You only know that the key used is a number between 1 and 100. Your program should try to decode the message using all possible keys between 1 and 100. When you try the valid key, the message will make sense. For all other keys, the message will appear as gibberish.

Added:
>
>

Problem 2

Write a sorting function that is similar to Display 7.12 in Chapter 7 except that it has an argument for a vector of ints rather than an array. This function will not need a parameter like number_used as in Display 7.12, since a vector can determine the number used with the member function size(). This sort function will have only this one parameter, which will be of a vec- tor type. Use the selection sort algorithm (which was used in Display 7.12).

Sort the following lists and turn in:

  1. 34,65,23,54,93,36,13,78,34,91,23,34,55,73
  2. 6,5,6,2,7,2,5,4,7,4,5,3,2,3

Revision 22015-11-01 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
Changed:
<
<

Lab 7

>
>

Lab 8

 

Due: Nov 12, 11:55pm

Instructions

Line: 12 to 12
 
Program correctness and completeness with respect to defination 70%
Code Format (Indenting, variable names) 10%
Code Comments 10%
Changed:
<
<
Turning in complete run of every function at least twice with difference values. 10%
>
>
Turning in the run with your solution to the encoding.. 10%
 

Problem 1

Your country is at war and your enemies are using a secret code to com- municate with each other. You have managed to intercept a message that reads as follows:

Line: 41 to 41
 Consequently, “Hey” would be transmitted as “Ro$.”

Write a program that decrypts the intercepted message. You only know that the key used is a number between 1 and 100. Your program should try to decode the message using all possible keys between 1 and 100. When you try the valid key, the message will make sense. For all other keys, the message will appear as gibberish.

Deleted:
<
<

Problem 2

Write a sorting function that is similar to Display 7.12 in Chapter 7 except that it has an argument for a vector of ints rather than an array. This function will not need a parameter like number_used as in Display 7.12, since a vector can determine the number used with the member function size(). This sort function will have only this one parameter, which will be of a vec- tor type. Use the selection sort algorithm (which was used in Display 7.12).

Revision 12015-10-29 - JimSkon

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="WebHome"

Lab 7

Due: Nov 12, 11:55pm

Instructions

  • Turn in the code (a cpp file or ideone.com link), and the run outputs as requested below.
  • Remember to format the code as described and the book and text, and to include comments including complete commetns at the beginning of the program.

Grading

Feature %
Program correctness and completeness with respect to defination 70%
Code Format (Indenting, variable names) 10%
Code Comments 10%
Turning in complete run of every function at least twice with difference values. 10%

Problem 1

Your country is at war and your enemies are using a secret code to com- municate with each other. You have managed to intercept a message that reads as follows:

:mmZ\dxZmx]Zpgy

The message is obviously encrypted using the enemy’s secret code. You have just learned that their encryption method is based upon the ASCII code. Appendix 3 shows the ASCII character set. Individual characters in a string are encoded using this system. For example, the letter “A” is encoded using the number 65 and “B” is encoded using the number 66.

Your enemy’s secret code takes each letter of the message and encrypts it as follows:

If (OriginalChar + Key > 126) then
    EncryptedChar = 32 + ((OriginalChar + Key) – 127)
Else
    EncryptedChar = (OriginalChar + Key)

For example, if the enemy uses Key = 10 then the message “Hey” would be encrypted as:

Character
<-- -->
Sorted ascending
ASCII code
e 101
H 72
y 121

  • Encrypted H = (72 + 10) = 82 = R in ASCII
  • Encrypted e = (101 + 10) = 111 = o in ASCII
  • Encrypted y = 32 + ((121 + 10) – 127) = 36 = $ in ASCII
Consequently, “Hey” would be transmitted as “Ro$.”

Write a program that decrypts the intercepted message. You only know that the key used is a number between 1 and 100. Your program should try to decode the message using all possible keys between 1 and 100. When you try the valid key, the message will make sense. For all other keys, the message will appear as gibberish.

Problem 2

Write a sorting function that is similar to Display 7.12 in Chapter 7 except that it has an argument for a vector of ints rather than an array. This function will not need a parameter like number_used as in Display 7.12, since a vector can determine the number used with the member function size(). This sort function will have only this one parameter, which will be of a vec- tor type. Use the selection sort algorithm (which was used in Display 7.12).
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback