Golfer's Handicap Program

I need help starting a do-while loop in my program that runs up to 10 time that asks the user to enter up to 10 scores, which include the slope and rating for the course, and calculates the handicap for each score. Any help is greatly appreciated. Here's what I have so far:


//This program calculates a golfers handicap.
#include <iostream>
#include <string>
using namespace std;

int main()
{

int score, slope;
double rating, handicap;
string name;


cout << "This program calculates a golfer's handicap.\n";

//Have the user to input their name, score, slope, and handicap.
cout << "Enter your name: ";
cin >> name;
cout << "Hello " << name << endl;
cout << "Please enter your score: ";
cin >> score;
cout << "Please enter the course slope: ";
cin >> slope;
cout << "Please enter the course rating: ";
cin >> rating;

//Calculate the golfers handicap
handicap = (score-rating) * 113 / slope ;
cout << "Your handicap is " << handicap << endl;


return 0;

}
Last edited on

We are not here to do your homework for you :)

Best thing to do is have a go, and post your code if/when you need any help with it. Simply writing it for you would be of no benefit to you.

Topic archived. No new replies allowed.