# C++ Programming

posted by .

Video Game Player Program

Write a program to do the following. In main declare a Player Name Array and a Score Array. Declare the size of the arrays to be 100. In the InputData function input the player name and score into the arrays for an unknown number of players up to 100.

• C++ Programming -

If you have a problem coding, post your code, we'll help you debug syntax or logic errors.

• C++ Programming -

using namespace std;

const double poundsPerKilogram = 2.2046;
const int ouncesPerPound = 16;
const int gramsPerKilogram = 1000;

void getInput(double& pounds, double& ounces);
// Precondition: User is ready to enter values correctly.
// Postcondition: The values of pounds and ounces have been set to the weight
// of the object.

double convertToGrams(double poundss, double ounces, double kilograms, double grams);
// Precondition: User is ready to enter values correctly.
// Postcondition: The values of kilograms and grams have been set to

void giveOutput(double kilograms, double grams);
// Precondition: The weight of the object is stored in kilograms and grams.
// Postcondition: The values of kilograms and grams have been written to the screen.

int main()
{
double pounds, ounces, kilograms, grams;
char ans;

do
{

getInput(pounds, ounces);
convertToGrams(kilograms, grams, pounds, ounces);
giveOutput(kilograms, grams);

cout << "Do you want to do another calculation?\n"
<< "Press y for yes, n for no,\n"
<< "and then press return: ";
cin >> ans;
cout << endl;

} while (ans == 'y' || ans == 'Y');

return 0;
}

void getInput(double& pounds, double& ounces)
{
cout << "Enter the weight of the object in pounds and ounces\n";
cout << "pounds: ";
cin >> pounds;
cout << "ounces: ";
cin >>ounces;

}

double convertToGrams(double pounds, double ounces, double kilograms, double grams)
{

kilograms = pounds / 2.2046;

kilograms = floor(kilograms); // extract just entire portion of kg
grams = (kilograms )*1000; // the substraction will be remaining grams
return kilograms;
return grams;
}

void giveOutput(double kilograms, double grams)
{

cout << "The object weighs " << kilograms << " kilograms and " << grams << " grams\n";

}

## Similar Questions

1. ### programming

I really need help in this it makes me confuse.I should make a program to find a pattern...so can somebody help me... Write a function to recognize an pattern within another array. Your function should have the following prototype. …
2. ### programming

John: 50,000 Joe: 30,000 Jane: 60,000 Jill: 25,000 Total: 165,000 Declare employees [4] Of Reals Declare Sum, Average As Real Declare salaries As Integer Set Sum = 0 For salaries = 1 Step 1 To 4 Write “Average salaries ”, salaries …
3. ### college

Write a C++ program to fill an array with 6 numbers, and then reverse the values of this array. Note: By using a function with two parameters with the name of the array and the size of this array.
4. ### Programming

Write a program to do the following: In main, declare a Player Name Array and a Score Array. Declare the size of the arrays to be 100. In the InputData( ) method, input the player name and score into the arrays for an unknown number …
5. ### pseudocode

Assume that your family has 10 members. Assume further that each family member has a certain amount of savings. Your task is to determine: (a) the total amount of savings that the family has, as a whole and (b) to determine who has …
6. ### Pseudocode with sequential, selection and arrays

Analyze, design, and document a simple program that utilizes a good design process and incorporates sequential, selection and repetitive programming statements as well as at least one function call and the use of at least one array. …
7. ### programming

Create the logic for a program that prompts a user for three numbers and stores them in an array. Pass the array to a method that reverses the order of the numbers. Display the reversed numbers in the main program.
8. ### programming

Write a program which allows user to enter 10 student names and scores for Java programming 1 and Java programming 2. Allow user to choose which course they want to enter the record for. Use the loop to ask input from user. The program …
9. ### programming

A. Write a program which reads an array of up to 200 integers from input and then does all the following in order 1. searches the array for a specific integer given by the user and outputs its position in the array; 2. outputs the …
10. ### Computer program

Need to know if I have it right or not in the program please . Input a list of positive numbers (terminated by 0) into an array, find the mean (average) of the numbers in the array, and output the result. Use a subprogram to input …

More Similar Questions