//******************************************************
// Filename: Solution_Lab_03.cpp
// Purpose:  Paint Your House Calculations
// Author:   Ken Busbee; ? 2008 Kenneth Leroy Busbee
// Date:     Dec 24, 2008
//******************************************************


// Headers and Other Technical Items

#include <iostream>
using namespace std;

// Function Prototypes

void pause(void);

double getValue();
double calculateArea();
double numgallons();
double totalCost();
              
//******************************************************
// main
//******************************************************
int main(void)
  {
  // Input - Test Data = 100, 40, 10, 28.49, 250
  //       - Alternate Test Data = 20, 30, 10, 12.34, 350
  
  getValue(); // function get value
  calculateArea(); // calculate total area
  numgallons(); // calculate the number of fallons
  totalCost() ; // calculate the total cost of paint
}

  
// function get value
double getValue()
{
      
       double length,
              width,
              height,
              price_gal_paint,
              coverage_gal_paint;
  cout << "\nEnter the length of the house in feet --->: ";
  cin >> length;
  
  cout << "\nEnter the width of the house in feet ---->: ";
  cin >> width;
  cout << "\nEnter the height of the house in feet --->: ";
  cin >> height;
  cout << "\nEnter the price of a gallon of paint ---->: ";
  cin >> price_gal_paint;
  cout << "\nEnter the coverage of a gallon of paint ->: ";
  cin >> coverage_gal_paint;
}
  // Process
  // function calculate area
double calculateArea(double total_area, double total_gal_paint, double total_cost)
{
length = getValue(length);
  total_area = (length * height * 2) + (width * height * 2);
  total_gal_paint = total_area / coverage_gal_paint + 0.9999;
  total_cost = total_gal_paint * price_gal_paint;
}

  // Output - Predicted Results From Test Data = 12, 341.88
  //          Alternate Test DAta Results = 3, 37.02
double numgallons ()
{
  cout << "\n";
  cout << "\nThe total gallons of paint needed is ---->: ";
  cout << total_gal_paint;
  cout << "\nThe total cost is ----------------------->: ";
  cout << total_cost;
}

  pause();

  return 0;
  }

//******************************************************
// pause
//******************************************************

void pause(void)
  {
  cout << "\n\n";
  system("PAUSE");
  cout << "\n\n";
  return;
  }

//******************************************************
// End of Program
//******************************************************

I am confused when writing code using the same name of variable
i don't know how the other function get the value that have already been declared in another funtion
and those are errors

C:\Users\se7olutionyg\Desktop\Untitled1.cpp In function `double calculateArea(double, double, double)':
any help would be appriciated

Why are you calling the prototype with no parameters? This would be the problem that I see.

//******************************************************
// Filename: Solution_Lab_03.cpp
// Purpose:  Paint Your House Calculations
// Author:   Ken Busbee; ? 2008 Kenneth Leroy Busbee
// Date:     Dec 24, 2008
//******************************************************


// Headers and Other Technical Items

#include <iostream>
using namespace std;

// Function Prototypes

void pause(void);

double calculate_paint(double, double,double, double);
double calculate_Cost(double,double);

              
//******************************************************
// main
//******************************************************
int main(void)
  {
  // Input - Test Data = 100, 40, 10, 28.49, 250
  //       - Alternate Test Data = 20, 30, 10, 12.34, 350
     double length,
            width,
            height,
            price_gal_paint,
            coverage_gal_paint,
            finalpaint,
            finalcost,
            total_gal_paint,
            total_cost;
  cout << "\nEnter the length of the house in feet --->: ";
  cin >> length;
  cout << "\nEnter the width of the house in feet ---->: ";
  cin >> width;
  cout << "\nEnter the height of the house in feet --->: ";
  cin >> height;
  cout << "\nEnter the price of a gallon of paint ---->: ";
  cin >> price_gal_paint;
  cout << "\nEnter the coverage of a gallon of paint ->: ";
  cin >> coverage_gal_paint;
  // painted area
  total_gal_paint = calculate_paint(length, height,  width,  coverage_gal_paint);
  total_cost = calculate_Cost(total_gal_paint);
  cout << "\n";
  cout << "\nThe total gallons of paint needed is ---->: ";
  cout << finalpaint;
  cout << "\nThe total cost is ----------------------->: ";
  cout << finalcost;
  pause();
  return 0;
  
}

  // Process
  // function calculate total gal
double calculate_paint (double length, double height, double width, double coverage_gal_paint)
{      
        double total_area, total_gal_paint; // local variable
        total_area = (length * height * 2) + (width * height * 2); // total area
        total_gal_paint = total_area / coverage_gal_paint + 0.9999; // total area painted
        return total_gal_paint;
}+-

// function calculate cost
double calculate_Cost(double total_gal_paint,double price_gal_paint)

{
  double total_cost;
  total_cost = total_gal_paint * price_gal_paint;
  return total_cost;
  
}

//******************************************************
// pause
//******************************************************

void pause(void)
  {
  cout << "\n\n";
  system("PAUSE");
  cout << "\n\n";
  return;
  }

//******************************************************
// End of Program
//***************************************************
***

this is my updated version

You are calling calculate_Cost() with only one parameter when you defined it with two.

Also I see "***" at the bottom not commented and +- at the end of your calculate_paint() function.

I am not sure if i can really help you, but i think if you read through this article about functions, might help!
http://alimsyed.com

lemme know if it did help!
cheers:)

//******************************************************
// Filename: Solution_Lab_03.cpp
// Purpose:  Paint Your House Calculations
// Author:   Ken Busbee; ? 2008 Kenneth Leroy Busbee
// Date:     Dec 24, 2008
//******************************************************


// Headers and Other Technical Items

#include <iostream>
#include<iomanip>
using namespace std;

// Function Prototypes

void pause(void);

double calculate_paint(double, double,double, double);
double calculate_Cost(double,double);

              
//******************************************************
// main
//******************************************************
int main(void)
  {
  // Input - Test Data = 100, 40, 10, 28.49, 250
  //       - Alternate Test Data = 20, 30, 10, 12.34, 350
     double length,
            width,
            height,
            price_gal_paint,
            coverage_gal_paint,
            finalpaint,
            finalcost,
            total_gal_paint,
            total_cost;
  cout << "\nEnter the length of the house in feet --->: ";
  cin >> length;
  cout << "\nEnter the width of the house in feet ---->: ";
  cin >> width;
  cout << "\nEnter the height of the house in feet --->: ";
  cin >> height;
  cout << "\nEnter the price of a gallon of paint ---->: ";
  cin >> price_gal_paint;
  cout << "\nEnter the coverage of a gallon of paint ->: ";
  cin >> coverage_gal_paint;
  // painted area
  total_gal_paint = calculate_paint(length, height,  width,  coverage_gal_paint);
  total_cost = calculate_Cost(total_gal_paint,price_gal_paint);
  
  cout << "\n";
  cout << "\nThe total gallons of paint needed is ---->: ";
  cout << setw(5)<<finalpaint;
  cout << "\nThe total cost is ----------------------->: ";
  cout << setw(5)<< finalcost;
  pause();
  return 0;
  
}

  // Process
  // function calculate total gal
double calculate_paint (double length, double height, double width, double coverage_gal_paint)
{      
        double total_area, total_gal_paint; // local variable
        total_area = (length * height * 2) + (width * height * 2); // total area
        total_gal_paint = total_area / coverage_gal_paint + 0.9999; // total area painted
        return total_gal_paint;
}

// function calculate cost
double calculate_Cost(double total_gal_paint,double price_gal_paint)

{
  double total_cost;
  total_cost = total_gal_paint * price_gal_paint;
  return total_cost;
  
}

//******************************************************
// pause
//******************************************************

void pause(void)
  {
  cout << "\n\n";
  system("PAUSE");
  cout << "\n\n";
  return;
  }

//******************************************************
// End of Program
//******************************************************

the program is compiling, but the result is sth like

Enter the length of the house in feet --->: 2

Enter the width of the house in feet ---->: 3

Enter the height of the house in feet --->: 4

Enter the price of a gallon of paint ---->: 45

Enter the coverage of a gallon of paint ->: 52


The total gallons of paint needed is ---->: 1.63619e+262
The total cost is ----------------------->: 8.88036e-056

Press any key to continue . . .


the same value for every input? can anybody explain me

This is because you aren't assigning finalpaint and finalcost a value. Go double check your code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.