cst 116 Austin Guertin 11a 10.10 pg 282-283 #1 (submit code and runs) #include using namespace::std; int main() { int Choice; int Dollars; int id[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; string Student_Club[10] = { "Computer Systems Society", "Society of Women Engineers", "Sigma Tu Gamma", "Trekkies", "Home Brewers", "High Altitude Ballooning", "Rugby", "IEEE", "International Club", "Dance Club" }; string President[10] = { "Kim Cares", "Jennie Queen", "Storm Drain", "C. Kirk", "Ross Coe", "Justin Time", "Ryan Johns", "Marc Bansmere", "Kong Mbonkum", "Will Shaver" }; int Students[10] = { 49, 51, 241, 230, 15, 19, 25, 36, 102, 64 }; for (int i = 0; i < 10; i++) { cout << "\n-----Club #" << i + 1 << "-----\n"; cout << "\nStudent Club: " << Student_Club[i] << "\nPresident: " << President[i] << "\nAmount of students: " << Students[i] << "\n"; } cout << "\n------------------------------------------------------------------------------------------\n"; cout << "\n\nOut of all of the students clubs, which one of the would you like to select:\n\n#"; cin >> Choice; if (Choice > 10 || Choice < 1) { cout << "\n\n\nYou have inputted an incorrect number, rerun the program.\n\n\n\n"; return 0; } cout << "\nYou want to choose club #" << Choice << "? So that is:\n"; cout << "\nStudent Club: " << Student_Club[Choice - 1] << "\nPresident: " << President[Choice - 1] << "\nAmount of students: " << Students[Choice - 1] << "\n"; Dollars = Students[Choice - 1] * 75; cout << "\nAnd since the club receives $75 for each student in the club, and there are " << Students[Choice - 1] << " students, \nand the club number is #" << Choice << ", or the club of " << Student_Club[Choice - 1] << ", it will receive $" << Dollars << "\n\n\n\n"; } 11b 10.14 pg 289-292 #1 (submit code and runs) #include #include using std::cin; using std::cout; using std::endl; using std::setw; void GetAndDisplayWelcomeInfo(); void FunctionOne(int varX[], int varY[]); void FunctionTwo(const int varX[], const int varY[], int varZ[]); void PrintFunction(const int varX[], const int varY[], const int varZ[]); const int SIZE = 5; int main() { int varX[5]; int varY[SIZE]; int varZ[SIZE]; // Notice how we used the const here! // Breakpoint 1 // Put breakpoint on the following line GetAndDisplayWelcomeInfo(); FunctionOne(varX, varY); // Breakpoint 3 // Put breakpoint on the following line FunctionTwo(varX, varY, varZ); PrintFunction(varX, varY, varZ); return 0; } void GetAndDisplayWelcomeInfo() { char name[2][20]; // First name in row 0, last name in row 1 cout << "Please enter your first name:"; cin >> name[0]; cout << "\nPlease enter your last name:"; cin >> name[1]; // Breakpoint 2 // Put breakpoint on the following line cout << "\n\n\tWelcome " << name[0] << " " << name[1] << "!\n\t Hope all is well \n\n"; } void FunctionOne(int varX[], int varY[]) { for (int x = 0; x < SIZE; x++) // NOTICE '<' NOT <= // Breakpoint 4 // Put breakpoint on the following line varX[x] = x; for (int x = 0; x < 5; x++) varY[x] = x + 100; } void FunctionTwo(const int varX[], const int varY[], int varZ[]) { for (int x = 0; x < SIZE; x++) // Notice the const SIZE here varZ[x] = varX[x] + varY[x]; } void PrintFunction(const int varX[20], const int varY[20], const int varZ[20]) { int x; cout << " \t x \t y \t z\n\n"; for (x = 0; x < SIZE; x++) cout << "\t" << setw(3) << varX[x] << "\t " << varY[x] << "\t " << varZ[x] << endl; } 11c 10.15 pg 292-293 #1 (submit code and runs) #include using namespace std; bool IsAPalindrome(string cString) { for (int i = 0; i < cString.length() / 2; i++) { if (cString[i] != cString[cString.length() - 1 - i]) { return false; } } return true; } bool IsAlphaStr(string cString) { for (int i = 0; i < cString.length(); i++) { if (!((cString[i] >= 'A' && cString[i] <= 'Z') || (cString[i] >= 'a' && cString[i] <= 'z'))) { return false; } } return true; } int CountChar(string cString, char ch) { int count = 0; for (int i = 0; i < cString.length(); i++) { if (cString[i] == ch) { count++; } } return count; } int main() { string s; cout << "Enter the string: \n\n"; cin >> s; if (IsAPalindrome(s)) { cout << "\nThis string --" << s << "-- is a palindrome\n" << endl; } else { cout << "\nThis string --" << s << "-- is not a palindrome\n" << endl; } if (IsAlphaStr(s)) { cout << "\nThis string --" << s << "-- is an alphabetic\n" << endl; } else { cout << "\nThe string --"<> ch; cout << "\nNumber of times --"<< ch << "-- has occurred: \n\n" << CountChar(s, ch) << endl; return 0; }