This will be using C++ and assembly language for 3 separate programs.
These programs will be a large part of your grade for Test #2. For each of these programs, 1. do the input/output using C++ 2. do all of the processing using inline assembly language 3. write ALL of the code in main() 4. you can declare other variables in main() Test #2.1 This program combines C++ and assembly to make the input and output reasonable. It uses an array of unsigned short integers (WORDs). 1. Write everything in main(); this program shouldn’t have any functions other than main(). 2. Declare and initialize the array shown below. unsigned short int nums [15] = {35,80,-1,16,4,22,37,99,100,80,80,17,4,80,-12}; 3. Input : get the user’s value to search for (an unsigned short integer) 4. Task #1: calculate how many times the user’s value occurs in the array. 5. Task #2: calculate the index (slot number) of the first instance of the user’s number. If the user’s number is not in the array, the slot number has no meaning. 6. Output : should look like User’s value : 80 Times found : 4 First index : 1 OR User’s value : -3 Times found : 0 First index : N/A Test #2.2 This program combines C++ and assembly to make the input and output reasonable. 1. Write everything in main(); this program shouldn’t have any functions other than main(). 2. Declare a single char. 3. Input : get the user’s value to search for (an unsigned short integer) 4. Task : classify the user’s char as being one of these types: uppercase alphabet letter lowercase alphabet letter digit from 1 – 9 (remember that we’re talking about a char here, not an int) special character (either ‘?’, ‘#’, or ‘$’ – and only these three) not classified (that is, none of the above) 5. Output : should look like one of these, depending on the input User’s char : ‘H’ Type : uppercase alphabet User’s char : ‘f’ Type : lowercase alphabet User’s char : ‘3’ Type : digit User’s char : ‘#’ Type : special character User’s char : ‘@’ Type : not classified Test #2.3 This program combines C++ and assembly to make the input and output reasonable. 1. Write everything in main(); this program shouldn’t have any functions other than main(). 2. Declare this array: char userString[100]; 3. Input : get the user’s “string”. Please notice that you can’t use a C++ string input function here; you’ve got to use a technique similar to what I showed you in the Project #3 specs so that you can input an array of chars. You’ll have to modify the code I showed you so that it will work with cin instead of an input file. Assume the user’s string will fit into the array, including the terminating zero. Assume that any alphabet letters the user enters will be lowercase. The user might enter punctuation, and/or spaces though. 4. Task : determine whether or not the user’s string is a palindrome; a palindrome is a string that is the same when it is reversed (like “race car”). Here are the specs: a. the string will contain only alphabet letters, spaces, or punctuation b. ignore spaces and punctuation when determining if the string is a palindrome; for instance, “race car” is a palindrome (ignore the space) “borrow or rob?” is a palindrome (ignore spaces and question mark) “yo, banana boy!” is a palindrome (ignore spaces, comma, and exclamation point) “never odd or even” is a palindrome (ignore spaces) “a man, a plan, a canal – panama!” is a palindrome (ignore spaces, commas, hyphen, and exclamation point) 5. Output : should look like one of these, depending on the input string : never odd or even It is a palindrome OR string : abcd e dca It is not a palindrome NOTE: Make sure that you test this program with all of the examples above; rest assured I’m going to do the same. Since this is an either/or type of answer, your code either works for all of them or it doesn’t. In other words, it will be darn near impossible to get part credit on this one if it fails even one of the tests. HINT: Consider using a second array into which you copy only the alphabet letters (no spaces or punctuation). That will make things a lot easier. If you do that, don’t forget a terminating zero! Please start these RIGHT AWAY. When you are done, copy them all into a single Word document to submit them: LastName, FirstName – Test2.docx