I have a program created in Visual Studio 2010. (I am a 10th Grade student at a technical school)
The problem with my program is that when it displays average, it is displayed as 186.00 instead of the actual correct result 186.67 (at least the calculator says 186.666666667)
Can you look at my code to fix it?
Thanks.
//PROGRAMMER NAME: Edward Reyes-Draper
//PROGRAM NAME: Bowling
//DATE CREATED: 3/10/2014
//PROGRAM PURPOSE: This program calculates information taken from the uesr to produce a table of the statistics of a bowling game.
void main()
{
char bowling_league [7], bowler_name [7]; //These statements declare variables for the program to use.
int game_1, game_2, game_3, total_pins;
float average;
cout << "Enter the Bowling League: "; //These statements asks the user for input and gets the input from the user.
cin >> bowling_league;
cout << "Enter the Bowler's Name: ";
cin >> bowler_name;
cout << "Enter the score for Game-1: ";
cin >> game_1;
cout << "Enter the score for Game-2: ";
cin >> game_2;
cout << "Enter the score for Game-3: ";
cin >> game_3;
cout << endl; //These statements create blank lines to give program an organized look.
cout << endl;
total_pins = game_1+game_2+game_3; //These statements provdide the program with mathematical expressions to display output.
average = total_pins / 3;