Question: C++ coding. Please help with the to do parts of the code. Do NOT use any else statements in the code. Code: /* * This
C++ coding. Please help with the "to do" parts of the code.
Do NOT use any "else" statements in the code.
Code:
/* * This class has 12 functions related by the fact that CSC 382 students are * reviewing C, functions, and algorithmic patterns such as Guarded Selection, * Alternative Selection, and Multiple Selection using C++. You are also learning * string objects and messages that you probably did not study in a C course. * * The functions will specifically use the if and if..else * statements written is virtually all languages because these * algorithmic patterns occur so frequently while developing software. */ #ifndef SELECTIONFUN_HPP_ #define SELECTIONFUN_HPP_ #includeusing namespace std; string letterGrade(double finalGrade) { /* * Complete lettergrade to return A, B, C, D, E according to UofA protocols (see our syllabus). * If finalGrade is out of range of 0.0 through 100.0, return "?" */ // TODO: Complete this function return "Under construction"; } // Function smallLongSmall ---------------------------------------------------- // Precondition: len(a) != len(b) string smallLongSmall(const string &a, const string &b) { /* You are given 2 strings, a and b. Return a string of the form short+long+short with the shorter string on the outside and the longer string on the inside. The strings will never be the same length. Either string may be empty (len 0). smallLongSmall("Hello", "hi") returns "hiHellohi" smallLongSmall("hi", "Hello") returns "hiHellohi" smallLongSmall("aaa", "b") returns "baaab" */ // TODO: Complete this function return "Under construction"; } string firstOf3(string const &a, string const &b, string const &c) { /* * You are given three string arguments. Return the string that alphabetically precedes * or is equal to the other two string arguments * * string("a", "b", "c") returns "a" * string("X", "b", "c") returns "X" * string("123", "1232", "123 0") returns "123" */ // TODO: Complete this function return "Under construction"; } // Function removeStart--------------------------------------------------- string removeStart(const string &a, const string &b) { /* Given two strings, concatenate them together and return the result. However, if the strings are different lengths, omit the beginning characters from the longer string so it is the same length as the shorter string. The strings may be any length. removeStart("Hello", "Hi") returns "loHi" removeStart("Hello", "java") returns "ellojava" removeStart("java", "Hello") returns "javaello" */ // TODO: Complete this function return "Under construction"; } // Precondition: The string argument is always lowercase and len(word) >= 3 string one_two(const string &word) { /* You are given a string name word. If word begins with "o" return "one". If word ends with "t" return "two". If both the "o" and "t" conditions are true, return "onetwo". If neither the "o" and "t" conditions are true, return the string unchanged. one_two("only one") returns "one" one_two("cart") returns "two" one_two("oft") returns "onetwo" one_two("abcde") returns "abcde" */ // TODO: Complete this function return "Under construction"; }
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
