I managed to get two working so far (reading from an external file, but I can't seem to get the third one to work, can any one show me what I have done wrong? Thank you
int main() {
int gardenn();
////Lawn\\\\
//Variables\\
//Costs
string lawnItem;
float inLawnCost;
float properLawnCost;
ifstream catalog;
catalog.open("priceCatalog.txt");
std::string lawnString;
while(catalog >> lawnString >> inLawnCost) {
if(lawnString == "lawn")
properLawnCost = inLawnCost;
}
//Length, Time & Other Variables
int lawnLength;
int lawnWidth;
int lawnTime = 20;
cout << "Length of lawn required: "; // Asks for the length
cin >> lawnLength; // Writes to variable
cout << "Width of lawn required: "; // Asks for the width
cin >> lawnWidth; // Writes to variable
int lawnArea = (lawnLength * lawnWidth); //Calculates the total area
cout << endl << "Area of lawn required is " << lawnArea << " square meters"; //Prints the total area
cout << endl << "This will cost a total of " << (lawnArea * properLawnCost) << " pounds"; //Prints the total cost
cout << endl << "This will take a total of " << (lawnArea * lawnTime) << " minutes" << endl << endl; //Prints total time
int totalLawnTime = (lawnArea * lawnTime);
////Concrete Patio\\\\
//Variables\\
//Costs
string concreteItem;
float inConcreteCost;
float properConcreteCost;
ifstream catalog1;
catalog1.open("priceCatalog.txt");
std::string concreteString;
while (catalog1 >> concreteString >> inConcreteCost) {
if(concreteString == "concrete")
properConcreteCost = inConcreteCost;
}
int concreteLength;
int concreteWidth;
int concreteTime = 20;
cout << "Length of concrete required: "; // Asks for the length
cin >> concreteLength; // Writes to variable
cout << "Width of concrete required: "; // Asks for the width
cin >> concreteWidth; // Writes to variable
int concreteArea = (concreteLength * concreteWidth); //Calculates the total area
cout << endl << "Area of concrete required is " << concreteArea << " square meters"; //Prints the total area
cout << endl << "This will cost a total of " << (concreteArea * properConcreteCost) << " pounds"; //Prints the total cost
cout << endl << "This will take a total of " << (concreteArea * concreteTime) << " minutes" << endl << endl; //Prints total time
int totalConcreteTime = (concreteArea * concreteTime);
////Wooden Deck\\\\
//Variables\\
//Costs
string woodenDeckItem;
float inWoodenDeckCost;
float properWoodenDeckCost;
ifstream catalog2;
catalog2.open("priceCatalog");
std::string woodenDeckString;
while (catalog2 >> woodenDeckString >> inWoodenDeckCost) {
if(woodenDeckString == "wooden")
properWoodenDeckCost == inWoodenDeckCost;
}
int woodenDeckLength;
int woodenDeckWidth;
int woodenDeckTime = 30;
cout << "Length of wooden deck required: "; // Asks for the length
cin >> woodenDeckLength; // Writes to variable
cout << "Width of wooden deck required: "; // Asks for the width
cin >> woodenDeckWidth; // Writes to variable
int woodenDeckArea = (woodenDeckLength * woodenDeckWidth); //Calculates the total area
cout << endl << "Area of wooden deck required is " << woodenDeckArea << " square meters"; //Prints the total area
cout << endl << "This will cost a total of " << (woodenDeckArea * properWoodenDeckCost) << " pounds"; //Prints the total cost
cout << endl << "This will take a total of " << (woodenDeckArea * woodenDeckTime) << " minutes" << endl << endl; //Prints total time
int totalWoodenDeckTime = (woodenDeckArea * woodenDeckTime);