私は一生、パテにあるこれらの単純な方程式の何が問題なのかを理解できません。すべてが正しく設定されていると思いますが、私の出力は私の教授のサンプル出力から少し間違っています。
//This program is used to calculate total cost of painting.
#include <iostream>
#include <iomanip>
using namespace std;
//These are the function prototypes that will be used for the main function.
void displayInstructions(int &feet, float &price);
float paintprice (int feet, float price);
float laborprice (int feet);
float totalcost(float paint, float labor);
void displayoutput (float paint, float labor, float total, int feet);
int main()
{
int feet=0;
float price=0;
float paint=0;
float labor=0;
float total=0;
displayInstructions(feet, paint);
paint=paintprice(feet, paint);
labor=laborprice(feet);
total=totalcost(labor, paint);
displayoutput(paint, labor, total, feet);
return 0;
}
void displayInstructions(int &feet, float &price)
{
cout<<setw(35)<<"==================================="<<endl;
cout<<setw(30)<<"Painting Cost Calculator" <<endl;
cout<<setw(35)<<"===================================" <<endl;
cout<<"This program will compute the costs (paint, labor, total)\nbased on th\
e square feet of wall space to be painted \
and \nthe price of paint." <<endl;
cout<<"How much wall space, in square feet, is going to be painted?" <<endl;
cin>>feet;
cout<<"How much is the price of a gallon of paint?" <<endl;
cin>>price;
}
float paintprice (int feet, float price)
{
float paint;
paint=((feet/115)*price);
return paint;
}
float laborprice (int feet)
{
float labor;
labor=((feet/115)*18*8);
return labor;
}
float totalcost (float paint, float labor)
{
float total;
total=(paint+labor);
return total;
}
void displayoutput (float paint, float labor, float total, int feet)
{
cout<<"Square feet:" <<feet <<endl;
cout<<"Paint cost:" <<paint <<endl;
cout<<"Labor cost:" <<labor <<endl;
cout<<"Total cost:" <<total <<endl;
}
フィート = 12900、価格 = 12.00 の入力に基づいて、塗料のコストの最終出力は 1346.09 ドルである必要があり、人件費の最終出力は 16153.04 ドルである必要があります
私はそれぞれ得る: $1344.00, $16128.00
あなたが私を助けることができれば、それは命の恩人になるでしょう.