Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this assignment, you will take the results of a recent election in a small city and report the results in different formats. First, you

For this assignment, you will take the results of a recent election in a small city and report the results in different formats.
First, you must read the results from a data file and store the values using vectors. The file has the last name of each candidate and the number of votes received on one line. There could be any number of lines in the file so the program needs to count them as it goes.
Finally, you must print the results arranged in order from the winner down to the person with the fewest votes. The report should include only the name of each candidate, the total votes received by that candidate and the percentage of the votes cast in the election for that candidate arranged in order from largest to smallest. Print the percentages with one decimal place.
Create the data file using the following records and put it into the project folder, name the file "votes.txt":

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions

Question

How does Disney try to redress prejudice and discrimination?

Answered: 1 week ago