2 Replies - 409 Views - Last Post: 19 November 2009 - 10:28 PM Rate Topic: -----

#1 airlaflair  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 24
  • Joined: 20-October 09

Programming Problems

Post icon  Posted 19 November 2009 - 09:49 PM

// Program Favorit determines the favorite soft drink.
#include <iostream>
using namespace std;
enum DrinksType {COKE, PEPSI, SPRITE, DR_PEPPER};
void Prompt();
// This function provides the input prompts.
int main ()
{
int sums[4];
int number;
DrinksType index;
for (index = COKE; index <= DR_PEPPER; index = DrinksType(index+1))
// FILL IN code to set sums to zero
Prompt();
cin >> number;
while (number != 4)
{
// FILL IN code to increment the proper drink
Prompt();
cin >> number;
}
// FILL IN code to write out the totals
return 0;
}
//*******************************************************
void Prompt()
{
cout << "Enter a 0 if your favorite is a Coke." << endl;
cout << "Enter a 1 if your favorite is a Pepsi." << endl;
cout << "Enter a 2 if your favorite is a Sprite." << endl;
cout << "Enter a 3 if your favorite is a Dr. Pepper." << endl;
cout <<"Enter a 4 if you wish to quit the survey." << endl;
}



Exercise 1: Complete program Favorit and run it. Which data did you use? What did
the program write?


Exercise 2: Add a function to program Favorit that sums the number of responses to
the survey. Pass the array sums as a parameter. Print the number of responses on the
screen. Run the program with the same data you used in Exercise 1. How many
responses were there?


Exercise 3: Add a function that takes the array sums as a parameter and prints the
percentage of responses each drink received. Run your program on the same data.
Show the results.

Is This A Good Question/Topic? 0
  • +

Replies To: Programming Problems

#2 airlaflair  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 24
  • Joined: 20-October 09

Re: Programming Problems

Posted 19 November 2009 - 10:18 PM

anyone?
Was This Post Helpful? 0
  • +
  • -

#3 ComputerAnalysis  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 92
  • Joined: 29-June 09

Re: Programming Problems

Posted 19 November 2009 - 10:28 PM

Ya buddy, we don't do homework here.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1