write a program in C Write a function that is passed an array of characters containing letter...

60.1K

Verified Solution

Question

Programming

write a program in C

Write a function that is passed an array of characterscontaining letter grades of A, B, C, D, and F, and returns thetotal number of occurrences of each letter grade. Your functionshould accept both lower and upper case grades, for example, both'b' and 'B' should be bucketed into your running total for Bgrades. Any grade that is invalid should be bucketed as a grade of'I' for Incomplete. You must use a switch statement, and yourfunction should accept an array of any size. Feel free to pass inthe array size as a parameter so you know how many grade valuesyou'll need to check in your loop. For example, if you passed afunction the following array: char grades [ ] = {'A', 'b', 'C','x', 'D', 'c', 'F', 'B', 'Y', 'B', 'B', 'A'}; It would return thefollowing information within a structure (gradeTotals) to thecalling function. Grade Total --------- ------ A 2 B 4 C 2 D 1 F 1I 2 Hint: Design the function as: struct gradeTotals gradeCount(char gradeArray [ ], int arraySize)

Answer & Explanation Solved by verified expert
4.3 Ratings (565 Votes)
C codeincludestructstruct gradeTotals char gradeA gradeB gradeC gradeD gradeF gradeI int countA0 countB0 countC0 countD0 countF0 countI 0Fucntion prototypestruct gradeTotals gradeCountchar    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students