Line: 1 to 1  

 
Changed:  
< <  Due: APril 17 11:55pm  
> >  Due: April 19 11:55pm  
Moodle Link 
Line: 1 to 1  

 
Changed:  
< <  Due: 11:55pm  
> >  Due: APril 17 11:55pm  
Changed:  
< <  Moodle Link  
> >  Moodle Link  
Line: 1 to 1  

 
Changed:  
< <  Moodle Link  
> >  Moodle Link  
Line: 1 to 1  

 
Line: 108 to 108  
using namespace std;  
Changed:  
< <  int main() { int n,d; cout << "Fraction test program." << endl; cout << "Enter numerator and denominator of first fraction:"; cin >> n >> d; Fraction a(n,d); cout << "Enter numerator and denominator of second fraction:"; cin >> n >> d; Fraction b(n,d); Fraction c = add(a,b); //Will be changed to use + operator //Fraction c = a+b;  
> >  // Default constructor Fraction::Fraction(void) { numerator = 0; denominator = 1; }  
Changed:  
< <  // Display Result cout << a.to_string() << " + " << b.to_string() << " = " << c.to_string() << endl; return 0;  
> >  // Constructor
Fraction::Fraction(int n, int d)
{
if (d == 0){
denominator = 1;
numerator = 0;
}else if (d < 0){
denominator = d * 1;
if (n > 0){
numerator = n * 1;
}
}else{
numerator = n;
denominator = d;
}
}
Fraction::~Fraction(void) {  
}  
Added:  
> >  // Returns the greatest common divisor of two integers
int Fraction::gcd(int a, int b)const{
while (b = 0){
int temp = b;
b = a % b;
a = temp;
}
return a;
}
// Simplifies the calling fraction void Fraction::simplify(){ int factor = gcd(numerator, denominator); numerator = numerator / factor; denominator = denominator / factor; } //test functions Fraction add(Fraction a, Fraction b) { int num = a.numerator * b.denominator + b.numerator * a.denominator; int den = a.denominator * b.denominator; Fraction result(num,den); result.simplify(); return result; } string Fraction::to_string() { string result = std::to_string(numerator) + "/" + std::to_string(denominator); return result; } // Overloaded Operators /* * In each case: (num1/den1) op (num2/den2) * * PLUS (+) OPERATOR * result = (num1 * den2 + num2 * den1) / (den1 * den2) * * MINUS () OPERATOR * result = (num1 * den2  num2 * den1) / (den1 * den2) * * MULIPLICATION (*) OPERATOR * result = (num1 * num2) / (den1 * den2) * * DIVISION (/) OPERATOR * result = (num1 * den2) / (den1 * num2) * * INSERTION (<<) operator * Output fraction in form n/d */  
%ENDCODE%  
Changed:  
< <  factions.cpp  
> >  main.cpp  
Line: 156 to 217  
%ENDCODE%
Runs to turn in:  
Added:  
> >  
Grading Table  
Changed:  
< < 
 
> > 
 

Line: 1 to 1  

 
Line: 11 to 10  
int main() { int n,d; cout << "Fraction test program." << endl;  
Added:  
> >  char again; do {  
cout << "Enter numerator and denominator of first fraction:"; cin >> n >> d; Fraction a(n,d);  
Line: 29 to 28  
cout << a.to_string() << " * " << b.to_string() << " = " << prod.to_string() << endl; cout << a.to_string() << " / " << b.to_string() << " = " << quotient.to_string() << endl;  
Added:  
> >  cout << endl << "Go again? (Y or y to continue):";
cin >> again;
} while (again = 'Y'  again = 'y');  
return 0; }  
Changed:  
< <  %ENDCODE% =  
> >  %ENDCODE% Fraction test program. Enter numerator and denominator of first fraction:1 2 Enter numerator and denominator of second fraction:3 4 1/2 + 3/4 = 5/4 1/2  3/4 = 1/4 1/2 * 3/4 = 3/8 1/2 / 3/4 = 2/3 Go again? (Y or y to continue):y Enter numerator and denominator of first fraction:1 10 Enter numerator and denominator of second fraction:1 20 1/10 + 1/20 = 3/20 1/10  1/20 = 1/20 1/10 * 1/20 = 1/200 1/10 / 1/20 = 2/1 Go again? (Y or y to continue):y Enter numerator and denominator of first fraction:23 57 Enter numerator and denominator of second fraction:101 31 23/57 + 101/31 = 6470/1767 23/57  101/31 = 5044/1767 23/57 * 101/31 = 2323/1767 23/57 / 101/31 = 713/5757 Go again? (Y or y to continue):n  
Consider the following code for representing fractions.
Fraction.h  
Line: 128 to 155  
} %ENDCODE%  
Changed:  
< < 
 
> >  Runs to turn in:
Grading Table
 

Line: 1 to 1  

 
Changed:  
< <  Moodle Link  
> >  Moodle Link  
Changed:  
< <  Fraction.h  
> >  < SyntaxHighlightingPlugin > int main() { int n,d; cout << "Fraction test program." << endl; cout << "Enter numerator and denominator of first fraction:"; cin >> n >> d; Fraction a(n,d); cout << "Enter numerator and denominator of second fraction:"; cin >> n >> d; Fraction b(n,d); Fraction sum = a+b; Fraction diff = ab; Fraction prod = a*b; Fraction quotient = a/b; // Display Results cout << a.to_string() << " + " << b.to_string() << " = " << sum.to_string() << endl; cout << a.to_string() << "  " << b.to_string() << " = " << diff.to_string() << endl; cout << a.to_string() << " * " << b.to_string() << " = " << prod.to_string() << endl; cout << a.to_string() << " / " << b.to_string() << " = " << quotient.to_string() << endl; return 0; } < end SyntaxHighlightingPlugin > Consider the following code for representing fractions. Fraction.h  
Line: 20 to 49  
Fraction(int n, int d); ~Fraction(void);  
Added:  
> >  // Test functions
string to_string();
 
// Overloaded operators // +, , *, and /  
Line: 37 to 70  
int gcd(int a, int b)const;
// Friend functions  
Changed:  
< <  // ...  
> >  friend Fraction add(Fraction a, Fraction b);  
}; %ENDCODE%  
Changed:  
< <  Fraction.cpp  
> >  Fraction.cpp  
Line: 49 to 81  
using namespace std;  
Changed:  
< <  // Default constructor Fraction::Fraction(void) { numerator = 0; denominator = 1;  
> >  int main() {
int n,d;
cout << "Fraction test program." << endl;
cout << "Enter numerator and denominator of first fraction:";
cin >> n >> d;
Fraction a(n,d);
cout << "Enter numerator and denominator of second fraction:";
cin >> n >> d;
Fraction b(n,d);
Fraction c = add(a,b);
//Will be changed to use + operator
//Fraction c = a+b;
// Display Result cout << a.to_string() << " + " << b.to_string() << " = " << c.to_string() << endl; return 0;  
}  
Changed:  
< <  // Constructor Fraction::Fraction(int n, int d) { if (d == 0){ denominator = 1; numerator = 0; }else if (d < 0){ denominator = d * 1; if (n > 0){ numerator = n * 1; } }else{ numerator = n; denominator = d; } }  
> >  %ENDCODE%  
Changed:  
< <  Fraction::~Fraction(void) { }  
> >  factions.cpp  
Changed:  
< <  // Returns the greatest common divisor of two integers int Fraction::gcd(int a, int b)const{ while (b = 0){ int temp = b; b = a % b; a = temp; } return a; }  
> >  using namespace std;  
Changed:  
< <  // Simplifies the calling fraction void Fraction::simplify(){ int factor = gcd(numerator, denominator); numerator = numerator / factor; denominator = denominator / factor;  
> >  int main() {
int n,d;
cout << "Fraction test program." << endl;
cout << "Enter numerator and denominator of first fraction:";
cin >> n >> d;
Fraction a(n,d);
cout << "Enter numerator and denominator of second fraction:";
cin >> n >> d;
Fraction b(n,d);
Fraction c = add(a,b);
//Will be changed to use + operator
//Fraction c = a+b;
// Display Result cout << a.to_string() << " + " << b.to_string() << " = " << c.to_string() << endl; return 0;  
}  
Deleted:  
< <  // Overloaded Operators /* * In each case: (num1/den1) op (num2/den2) * * PLUS OPERATOR * result = (num1 * den2 + num2 * den1) / (den1 * den2) * * MINUS OPERATOR * result = (num1 * den2  num2 * den1) / (den1 * den2) * * MULIPLICATION OPERATOR * result = (num1 * num2) / (den1 * den2) * * DIVISION OPERATOR * result = (num1 * den2) / (den1 * num2) */  
%ENDCODE%  
Added:  
> > 
 
 
Added:  
> > 

Line: 1 to 1  

 
Changed:  
< <  Lab 8  Encryption and VectorsDue: April 13, 11:55pm  
> >  Lab 8  Operator OverloadingDue: 11:55pm  
Changed:  
< <  Moodle LinkInstructions
GradingGrading Table
Problem 1  Decrypt a secret messageYour country is at war and your enemies are using a secret code to communicate 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:
 
> >  Moodle Link  
Changed:  
< <  Write a program that decrypts the intercepted message above. You will need to write a function that, giving a character, reverses the encryption operation.
The problem is that you only know that the key used to do the encryption is a number between 1 and 100. Your program will need to try all possible keys to decode the message. When you try the valid key, the message will make sense. For all other keys, the message will appear as gibberish. You should use the string class for this lab. Two functions you might create are:  
> >  Fraction.h  
Deleted:  
< <  // Use key to decrypt encryptedChar, returning the character.
char decryptChar(char encryptedChar, int key);
// Use key to decrypt encryptedStr, returning the decrypted string. // This function will use decryptChar above string decryptString(string encryptedStr, int key); %ENDCODE%
Below is an example of some string processing:
 
#include  
Deleted:  
< <  
using namespace std;  
Changed:  
< <  string reverse(string s) { int len = s.length(); int last = len1; string r(s);  
> >  class Fraction { public: // Constructors and Destructor Fraction(void); Fraction(int n, int d); ~Fraction(void);  
Changed:  
< <  for (int i = 0; i < len; i++) { r[last  i] = s[i]; } return r; }  
> >  // Overloaded operators // +, , *, and /  
Deleted:  
< <  int main() { string str; cout << "Enter a string: "; getline(cin, str); cout << reverse(str) << endl;  
Changed:  
< <  return 0; }  
> >  private: int numerator; //the "top" of the fraction int denominator; //the "bottom" of the fraction  
Added:  
> >  // PRE: // POST: Fraction is simplified, e.g. 3/9, simplifies to 1/3 void simplify();  
Changed:  
< <  %ENDCODE%  
> >  // PRE: // POST: Returns the greatest common divisor of a and b int gcd(int a, int b)const;  
Changed:  
< <  Problem 2  Sort with Vectors  
> >  // Friend functions // ... }; %ENDCODE%  
Changed:  
< <  Recall the sort program we studied earlier:
Sort Array  
> >  Fraction.cpp  
Added:  
> >  #include "Fraction.h"  
using namespace std;  
Deleted:  
< <  void displayValues(int scores[], int scoreCount) { for (int i = 0 ; i < scoreCount ; i++) { cout << scores[i] << " "; } cout << endl; }  
Changed:  
< <  void inputValues(int scores[], int aSize, int& scoreCount) { int i=0; do { cin >> scores[i++]; } while (scores[i1] > 0 && i < aSize); if (scores[i1] < 0) { i; } scoreCount = i; } void swap_values(int& v1, int& v2)  
> >  // Default constructor Fraction::Fraction(void)  
{  
Changed:  
< <  int temp; temp = v1; v1 = v2; v2 = temp;  
> >  numerator = 0; denominator = 1;  
}  
Changed:  
< <  int index_of_smallest(const int a[], int start_index, int number_used)  
> >  // Constructor Fraction::Fraction(int n, int d)  
{  
Changed:  
< <  int min = a[start_index]; int index_of_min = start_index; for (int index = start_index + 1; index < number_used; index++) if (a[index] < min) { min = a[index]; index_of_min = index; //min is the smallest of a[start_index] through a[index]  
> >  if (d == 0){ denominator = 1; numerator = 0; }else if (d < 0){ denominator = d * 1; if (n > 0){ numerator = n * 1; } }else{ numerator = n; denominator = d;  
}  
Deleted:  
< <  return index_of_min;  
}  
Changed:  
< <  void sort(int a[], int number_used)  
> >  Fraction::~Fraction(void)  
{  
Deleted:  
< <  int index_of_next_smallest;
for (int index = 0; index < number_used  1; index++)
{//Place the correct value in a[index]:
index_of_next_smallest = index_of_smallest(a, index, number_used); swap_values(a[index], a[index_of_next_smallest]); //a[0] <= a[1] <=...<= a[index] are the smallest of the original array //elements. The rest of the elements are in the remaining positions. }  
}  
Changed:  
< <  const int MAX = 100;
int main() {
int theNums[MAX];
int ncount;
cout << "Input up to " << MAX << " Values to sort, 1 to end: ";
inputValues(theNums, MAX, ncount);
displayValues(theNums, ncount);
sort(theNums, ncount);
displayValues(theNums, ncount);
return 0;  
> >  // Returns the greatest common divisor of two integers int Fraction::gcd(int a, int b)const{ while (b = 0){ int temp = b; b = a % b; a = temp;  
}  
Changed:  
< < 
%ENDCODE%
Rewrite this program to use only vectors (not c arrays). Below is a sample program that uses vectors. Test Run data
Using a Vector
int main( )
{
vector int next; cin >> next; while (next > 0) { v.push_back(next); cout << next << " added. "; cout << "v.size( ) = " << v.size( ) << endl; cin >> next;  
> >  return a;  
}  
Changed:  
< <  cout << "You entered:\n";
for (unsigned int i = 0; i < v.size( ); i++)
cout << v[i] << " ";
cout << endl;
return 0;  
> >  // Simplifies the calling fraction void Fraction::simplify(){ int factor = gcd(numerator, denominator); numerator = numerator / factor; denominator = denominator / factor;  
}  
Changed:  
< <  %ENDCODE%  
> >  // Overloaded Operators /* * In each case: (num1/den1) op (num2/den2) * * PLUS OPERATOR * result = (num1 * den2 + num2 * den1) / (den1 * den2) * * MINUS OPERATOR * result = (num1 * den2  num2 * den1) / (den1 * den2) * * MULIPLICATION OPERATOR * result = (num1 * num2) / (den1 * den2) * * DIVISION OPERATOR * result = (num1 * den2) / (den1 * num2) */  
Changed:  
< <  Solution  
> >  %ENDCODE%  

Line: 1 to 1  

 
Changed:  
< <  Moodle Link  
> >  Moodle Link  
Instructions  
Added:  
> > 
 
GradingGrading Table  
Line: 22 to 24  
 
Changed:  
< <  Problem 1  
> >  Problem 1  Decrypt a secret message  
Your country is at war and your enemies are using a secret code to communicate with each other. You have managed to intercept a message that reads as follows:  
Line: 95 to 98  
%ENDCODE%  
Changed:  
< <  Problem 2  Using Vectors  
> >  Problem 2  Sort with Vectors  
Recall the sort program we studied earlier:
Sort Array 
Line: 1 to 1  

 
Changed:  
< <  Due: Nov 10, 11:55pm  
> >  Due: April 13, 11:55pm  
Instructions

Line: 1 to 1  

 
Line: 52 to 52  
The problem is that you only know that the key used to do the encryption is a number between 1 and 100. Your program will need to try all possible keys to decode the message. When you try the valid key, the message will make sense. For all other keys, the message will appear as gibberish.  
Changed:  
< <  You should use the string class for this lab. Below is an example of some string processing:  
> >  You should use the string class for this lab. Two functions you might create are:
< SyntaxHighlightingPlugin > // Use key to decrypt encryptedChar, returning the character. char decryptChar(char encryptedChar, int key); // Use key to decrypt encryptedStr, returning the decrypted string. // This function will use decryptChar above string decryptString(string encryptedStr, int key); < end SyntaxHighlightingPlugin > Below is an example of some string processing:  
Line: 198 to 209  
return 0; }  
Changed:  
< <  %ENDCODE%  
> >  %ENDCODE%  
Changed:  
< <  Solution  
> >  Solution  

Line: 1 to 1  

 
Line: 198 to 198  
return 0; }  
Changed:  
< <  %ENDCODE%  
> >  %ENDCODE%  

Line: 1 to 1  

 
Changed:  
< <  Lab 8  Encryption  
> >  Lab 8  Encryption and Vectors  
Due: Nov 10, 11:55pmInstructions
 
Deleted:  
< < 
 
Grading  
Added:  
> >  Grading Table
 
Deleted:  
< < 
 
Problem 1  
Changed:  
< <  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:  
> >  Your country is at war and your enemies are using a secret code to communicate with each other. You have managed to intercept a message that reads as follows:  
:mmZ\dxZmx]Zpgy  
Line: 42 to 48  
 
Changed:  
< <  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.  
> >  Write a program that decrypts the intercepted message above. You will need to write a function that, giving a character, reverses the encryption operation.  
Changed:  
< <  Problem 2  
> >  The problem is that you only know that the key used to do the encryption is a number between 1 and 100. Your program will need to try all possible keys to decode the message. When you try the valid key, the message will make sense. For all other keys, the message will appear as gibberish.  
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 vector type. Use the selection sort algorithm (which was used in Display 7.12).  
> >  You should use the string class for this lab. Below is an example of some string processing:
< SyntaxHighlightingPlugin > #include <iostream> #include <string> using namespace std; string reverse(string s) { int len = s.length(); int last = len1; string r(s); for (int i = 0; i < len; i++) { r[last  i] = s[i]; } return r; } int main() { string str; cout << "Enter a string: "; getline(cin, str); cout << reverse(str) << endl; return 0; } < end SyntaxHighlightingPlugin >
Problem 2  Using VectorsRecall the sort program we studied earlier: Sort Arrayvoid inputValues(int scores[], int aSize, int& scoreCount) { int i=0; do { cin >> scores[i++]; } while (scores[i1] > 0 && i < aSize); if (scores[i1] < 0) { i; } scoreCount = i; } void swap_values(int& v1, int& v2) { int temp; temp = v1; v1 = v2; v2 = temp; }
int index_of_smallest(const int a[], int start_index, int number_used) { int min = a[start_index]; int index_of_min = start_index; for (int index = start_index + 1; index < number_used; index++) if (a[index] < min) { min = a[index]; index_of_min = index; //min is the smallest of a[start_index] through a[index] } return index_of_min; } void sort(int a[], int number_used) { int index_of_next_smallest; for (int index = 0; index < number_used  1; index++) {//Place the correct value in a[index]: index_of_next_smallest = index_of_smallest(a, index, number_used); swap_values(a[index], a[index_of_next_smallest]); //a[0] <= a[1] <=...<= a[index] are the smallest of the original array //elements. The rest of the elements are in the remaining positions. } } const int MAX = 100; int main() { int theNums[MAX]; int ncount; cout << "Input up to " << MAX << " Values to sort, 1 to end: "; inputValues(theNums, MAX, ncount); displayValues(theNums, ncount); sort(theNums, ncount); displayValues(theNums, ncount);  
Changed:  
< <  Sort the following lists and turn in:  
> >  return 0; }  
Added:  
> >  %ENDCODE%
Rewrite this program to use only vectors (not c arrays). Below is a sample program that uses vectors. Test Run data  
 
Changed:  
< < 
 
> > 
Using a Vector< SyntaxHighlightingPlugin > //DISPLAY 8.9 Using a Vector #include <iostream> #include <vector> using namespace std; int main( ) { vector<int> v; cout << "Enter a list of positive numbers.\n" << "Place a negative number at the end.\n"; int next; cin >> next; while (next > 0) { v.push_back(next); cout << next << " added. "; cout << "v.size( ) = " << v.size( ) << endl; cin >> next; } cout << "You entered:\n"; for (unsigned int i = 0; i < v.size( ); i++) cout << v[i] << " "; cout << endl; return 0; } < end SyntaxHighlightingPlugin >  

Line: 1 to 1  

 
Changed:  
< <  Lab 8  
> > 
 
Due: Nov 10, 11:55pm  
Added:  
> >  
Instructions
 
Line: 35 to 37  
 
Changed:  
< < 
 
> > 
 
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.  
Line: 48 to 50  
Sort the following lists and turn in:  
Deleted:  
< < 
 
\ No newline at end of file  
Added:  
> > 

Line: 1 to 1  

Lab 8  
Changed:  
< <  Due: Nov 13, 11:55pm  
> >  Due: Nov 10, 11:55pm  
Instructions
 
Line: 18 to 18  
:mmZ\dxZmx]Zpgy  
Changed:  
< <  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.  
> >  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:  
Deleted:  
< <  Your enemy’s secret code takes each letter of the message and encrypts it as follows:  
If (OriginalChar + Key > 126) then  
Changed:  
< <  EncryptedChar = 32 + ((OriginalChar + Key) – 127)  
> >  EncryptedChar = 32 + ((OriginalChar + Key) – 127)  
Else EncryptedChar = (OriginalChar + Key)  
Changed:  
< <  For example, if the enemy uses Key = 10 then the message “Hey” would be encrypted as:  
> >  For example, if the enemy uses Key = 10 then the message “Hey” would be encrypted as:  
 
Line: 36 to 37  
 
Changed:  
< < 
 
> > 
 
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. 
Line: 1 to 1  

Lab 8Due: 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: 
Line: 1 to 1  

Lab 8  
Changed:  
< <  Due: Nov 12, 11:55pm  
> >  Due: Nov 13, 11:55pm  
Instructions

Line: 1 to 1  

Lab 8Due: 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 2Write 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:

Line: 1 to 1  

 
Changed:  
< <  Lab 7  
> >  Lab 8  
Due: Nov 12, 11:55pmInstructions  
Line: 12 to 12  
 
Changed:  
< < 
 
> > 
 
Problem 1Your 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 2Write 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). 
Line: 1 to 1  

Added:  
> > 
Lab 7Due: Nov 12, 11:55pmInstructions
Grading
Problem 1Your 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:
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 2Write 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). 