Keep getting Run-Time Check Failure #3

Write your question here.

// Sergio Rogue-Garcia
// March 19, 2018
// Lab 3 -

#include <iostream>
#include <iomanip>
#include <string>

using namespace std;
// Function Prototypes
void welcome();
void getInfo(string &, string &);
int selectShape();
void getLenWid(double&, double&);
double calcSqFeet(double, double);
double getDiam();
double calcSqFeet(double); //formula: PI * radius*radius
int selectFloorGrade();
double calcTotalPrice(int, double);
void displayEstimate(string, string, double, int, double);
void goodBye();

//constants
const double PI = 3.14;
const double STAND_PRICE = 41.50;
const double PREMI_PRICE = 63.75;


int main()
{
string name;
char decide;
string phone_number;
int choice;
double length;
double width;
double sqFeet;
double diameter;
int floor;
double TotalPrice;


welcome();

getInfo(name, phone_number);

do
{
choice = selectShape();
if (choice == 1)
{
getLenWid(length, width);
calcSqFeet(length, width);

}
if (choice == 2)
{
getDiam();
calcSqFeet(diameter);
}
else
{
cout << "Please enter a vaild number." << endl;
}
floor = selectFloorGrade();
calcTotalPrice(floor, sqFeet);
(Line 66) displayEstimate(name, phone_number, sqFeet, choice, TotalPrice);

cout << "\tWould you like another estimate? (yes - y or no - n)" << endl;
cin >> decide;
} while (decide == 'y' || decide == 'Y');

cout << endl;
goodBye;
system("pause");
return 0;
}

// Function for Welcome message
void welcome()
{
cout << "\tWelcome to Sergio Concrete Inc.\n";
cout << "\tOur mission is to supply you with the best quality\n";
cout << "\tsupply and offer the best service we can." << endl;
cout << endl;
}

// Function to get customers information
void getInfo(string& name, string& phone_number)
{
cout << "Please enter full name" << endl;
getline(cin, name);
cout << "Please enter your phone number" << endl;
cout << "Ex. 123.456.7890" << endl;
getline(cin, phone_number);
}
// Input for shape of function
int selectShape()
{
int choice;

cout << "To describe the shape of the floor, please select 1 or 2.\n";
cout << "1. Rectangular\n";
cout << "2. Circular\n";
cin >> choice;
cin.ignore();

return choice;
}

// Function for rectangular shape
void getLenWid(double& length, double& width)
{
cout << "Please input the length of your floor\n";
cout << "\t(rounding up to the nearest half foot, ex:11.5) :" << endl;
cin >> length;

cout << "Please input the width of your floor\n";
cout << "\t(rounding up to the nearest half foot, ex:11.5) :" << endl;
cin >> width;
}

// Function for sq feet of rectangular shape
double calcSqFeet(double length, double width)
{
double sqFeet;

sqFeet = length * width;

return sqFeet;
}

// Function for circular shape
double getDiam()
{
double diameter;

cout << "Please inpuit the diameter of your floor\n";
cout << "\t(rounding up to the nearest half foot, ex:11.5) :" << endl;
cin >> diameter;

return diameter;
}

double calcSqFeet(double diameter)
{
double radius;
double sqFeet;

radius = diameter / 2;
sqFeet = PI * radius * radius;

return sqFeet;
}

// Function to select types of floor
int selectFloorGrade()
{
int floor;

cout << "There are 2 grades of floor that are available.\n";
cout << "All prices are based on square feet.\n";
cout << endl;
cout << "1. Standard grade $" << STAND_PRICE << "per square foot.\n";
cout << "2. Premium grade $" << PREMI_PRICE << "per square foot.\n";
cout << endl;
cout << "To select the type of floor, please enter 1 or 2" << endl;
cin >> floor;

return floor;
}

// Function to calculate total price
double calcTotalPrice(int floor, double sqFeet)
{
double TotalPrice;

if (floor == 1)
{
TotalPrice = STAND_PRICE * sqFeet;
}
if (floor == 2)
{
TotalPrice = PREMI_PRICE * sqFeet;
}

return TotalPrice;
}

// Function for estimate
void displayEstimate(string name, string phone_number, double sqFeet, int floor, double TotalPrice)
{
cout << "\tEstimate\n";
cout << "Customer Name: " << name << endl;
cout << "Telephone number; " << phone_number << endl;

cout << endl;

cout << "Square feet: " << sqFeet << endl;
cout << "Floor Grade: " << floor << endl;
cout << "\tTotal cost: " << TotalPrice << endl;

cout << endl;
cout << " March 19th, 2018 " << endl;
cout << "This estimate is valid for 30 days from the date above" << endl;
}

// Function for GoodBye
void goodBye()
{
cout << "\tThank you for visiting Sergio Concrete Inc.\n";
cout << "Please call 123-456-7890 to schedule an on-site appointment" << endl;
}

 In function 'int main()':
74:8: warning: statement is a reference, not call, to function 'goodBye' [-Waddress]
74:8: warning: statement has no effect [-Wunused-value]
 In function 'double calcTotalPrice(int, double)':
187:8: warning: 'TotalPrice' may be used uninitialized in this function [-Wmaybe-uninitialized]
 In function 'int main()':
67:64: warning: 'sqFeet' may be used uninitialized in this function [-Wmaybe-uninitialized]
67:64: warning: 'TotalPrice' may be used uninitialized in this function [-Wmaybe-uninitialized]

I suggest searching how to enable warnings on your compiler.
Topic archived. No new replies allowed.