// 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;
// 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;
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;
}
If a function returns a value, you need to do something with that value.
Bad:
1 2 3
double sqFeet; // sqFeet has some random value
calcSqFeet(diameter);
// Here, sqFeet STILL has some random value. Whatever came back from the function calcSqFeet, you threw it away.
Good:
1 2 3
double sqFeet; // sqFeet has some random value
sqFeet = calcSqFeet(diameter);
// Here, sqFeet has been set to whatever value came back from the function call