Solution

// Nathan Eloe 2/2/2013

// hairdoCalc.cpp

// A program to calculate the height of Marge's massive hairdo

#include <iostream>

using namespace std;

int main()

{

const float GROWTH_RATE = 0.2;

// In Springfield, gravity is stronger than usual, because of the

// nuclear plant. D'OH

const float GRAVITY = 9.98;

// Variables

int daysSinceCut;

int numCansSpray;

// The majestic moose. Their bites can be quite nasty, you know...

bool wasMoussed;

float curlingTemp;

float hairHeight;

cout << "Greetings, Marge. Let's find out how tall your monolith of hair\n"

<< "is today, shall we?\n";

cout << "\tHow many days has it been since your last haircut? ";

cin >> daysSinceCut;

cout << "\tAh, excellent. And how many cans of hairspray did you use? ";

cin >> numCansSpray;

cout << "\tAnd did you use your mousse(0 for no, 1 for yes)? ";

cin >> wasMoussed;

cout << "\tAnd finally, just how hot was your curling iron? ";

cin >> curlingTemp;

hairHeight = static_cast<float>(numCansSpray) / (daysSinceCut + 1);

hairHeight *= (2 + curlingTemp);

hairHeight -= GRAVITY;

hairHeight += GROWTH_RATE * daysSinceCut;

cout << "\nYour hair height this fine day is: " << hairHeight << " inches!\n\n";

cout << "Impressive! Very majestic. Like the majestic moose.\n\n";

cout << "DISCLAIMER: It is not recommended to karve your initials on the\n"

<< "moose with the sharpened end of an interspace toothbrush...\n\n"

<< "Have a nice day!" << endl;

return 0;

}