Chapter 10 Homework

Chapter 10 Homework - Ch. 10 Homework By Daniel Fore def45...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Ch. 10 Homework By Daniel Fore def45 Programming Challenges: 9, 12 “On my honor, as a Mississippi State University student, I have neither given nor received unauthorized assistance on this academic work.” Student Signature x_____Daniel Edward Fore ______ CSE1284 Introduction to Computer Programming Lisa Henderson November 19, 2007
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Page 588: Programming Challenges: 9 #include <iostream> #include <string> using namespace std; char frequentCharacterString(string *); int main() { char stringInput[999]; string userString; string * stringPtr; stringPtr = &userString; char mostFrequentChar; cout << "Enter a string: "; cin.getline(stringInput, 999); userString = stringInput; mostFrequentChar = frequentCharacterString(stringPtr); cout << "The most frequent character that appears in the string is " << mostFrequentChar << "." << endl; } char frequentCharacterString(string * userString) { string tempString = *userString; char mostFrequentChar = '*'; char firstCharacter; int greatestNum = 0; int stringSize; int acount = 0, bcount = 0, ccount = 0, dcount = 0, ecount = 0, fcount = 0, gcount = 0, hcount = 0, icount = 0, jcount = 0, kcount = 0, lcount = 0, mcount = 0, ncount = 0, ocount = 0, pcount = 0, qcount = 0, rcount = 0, scount = 0, tcount = 0, ucount = 0, vcount = 0, wcount = 0, xcount = 0, ycount = 0, zcount = 0; stringSize = tempString.size(); firstCharacter = tempString.at(0); for (int i = 0; i < stringSize; i++) { switch (firstCharacter) { case 'A': case 'a': acount += 1; break; case 'B': case 'b': bcount += 1; break;
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/15/2009 for the course CSE 1284 taught by Professor Henderson,lisa during the Fall '07 term at Mississippi State.

Page1 / 8

Chapter 10 Homework - Ch. 10 Homework By Daniel Fore def45...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online