C++ 错误:';的重载不明确;运营商>&燃气轮机';在';标准:cin>&燃气轮机;结算资格'| #包括 #包括 使用名称空间std; void calculateCarpetSize(整数长度、整数宽度) { 浮动地毯尺
错误:';的重载不明确;运营商>&燃气轮机';在';标准:cin>&燃气轮机;结算资格'|C++ 错误:';的重载不明确;运营商>&燃气轮机';在';标准:cin>&燃气轮机;结算资格'| #包括 #包括 使用名称空间std; void calculateCarpetSize(整数长度、整数宽度) { 浮动地毯尺,c++,compiler-errors,C++,Compiler Errors,错误:';的重载不明确;运营商>&燃气轮机';在';标准:cin>&燃气轮机;结算资格'| #包括 #包括 使用名称空间std; void calculateCarpetSize(整数长度、整数宽度) { 浮动地毯尺寸=(长度*宽度); cout.setf(ios::fixed); 计算精度(0); } void calculateCarpetPrice(浮动地毯尺寸、浮动销售价格) { 浮动地毯价格=(地毯尺寸*售价); } void calculate
#包括
#包括
使用名称空间std;
void calculateCarpetSize(整数长度、整数宽度)
{
浮动地毯尺寸=(长度*宽度);
cout.setf(ios::fixed);
计算精度(0);
}
void calculateCarpetPrice(浮动地毯尺寸、浮动销售价格)
{
浮动地毯价格=(地毯尺寸*售价);
}
void calculateCarpetCost(浮动地毯尺寸、浮动销售价格)
{
浮动销售税=0.14;
浮动地毯成本=(地毯尺寸*售价*销售税);
计算精度(2);
}
无效成本(浮动地毯尺寸、浮动人工)
{
人工=24.00;
浮动人工成本=地毯尺寸*人工;
}
bool qualifyForDiscount(int customerNumber)
{
如果(客户编号<99999)
{
无效计算贴现(浮动成本);
返回true;
}
其他的
{
返回false;
}
}
无效计算贴现(浮动成本、浮动折扣百分比)
{
不能贴现百分比;
浮动地毯成本折扣=地毯成本*折扣百分比;
}
作废打印客户声明()
{
cout.setf(ios::fixed);
coutqualifyForDiscount
是一个函数。您不能输入函数。qualifyForDiscount
是一个函数。std::cin>>qualifyForDiscount
应该做什么?关于函数和作用域的教程会有很大帮助。您试图以多种不正确的方式调用函数,并试图神奇地共享l函数之间的局部变量,而不是使用返回值。我建议您从小处开始。这意味着太多的代码和太多没有意义的东西。例如void calculateCarpetPrice(float-ru毯大小,float-sellingPrice){float-ru毯价格=(ru毯大小*sellingPrice);}……没有错误,但仍然没有做你认为的事情。试着用一个函数来制作一个程序,然后尝试把它弄清楚,然后再添加…打开你最喜欢的C++书籍,在第1章开始阅读。不要忘记阅读课文,不要只看例子。做所有的练习,尤其是那些练习。不要跳过,因为它们太容易了。
#include <iostream>
#include <string>
using namespace std;
void calculateCarpetSize (int length, int width)
{
float carpetSize = (length * width);
cout.setf(ios::fixed);
cout.precision(0);
}
void calculateCarpetPrice (float carpetSize, float sellingPrice )
{
float carpetPrice = ( carpetSize * sellingPrice );
}
void calculateCarpetCost (float carpetSize, float sellingPrice )
{
float salesTax = 0.14;
float carpetCost = (carpetSize * sellingPrice * salesTax);
cout.precision(2);
}
void calculateLabourCost ( float carpetSize, float labour)
{
labour = 24.00;
float labourCost = carpetSize * labour;
}
bool qualifyForDiscount (int customerNumber)
{
if ( customerNumber < 99999)
{
void computeDiscount (float carpetCost);
return true;
}
else
{
return false;
}
}
void computeDiscount (float carpetCost, float discountPercentage)
{
cout << "Enter the percentage discount ." << endl;
cin >> discountPercentage;
float carpetCostDiscount = carpetCost * discountPercentage;
}
void printCustomerStatement( )
{
cout.setf(ios::fixed);
cout << endl;
cout << "CROSWELL CARPET STORE" << endl;
cout << "STATEMENT" << endl;
}
int main()
{
int customerName;
int customerSurname;
int customerNumber;
float carpetSize;
float carpetPrice;
float sellingPrice;
float salesTax = 0.14;
float labourCost;
int labour = 24.00;
float length;
float width;
float discount;
float discountPercentage;
cout.setf(ios::fixed);
cout.precision(2);
cout << "Please enter the information" << endl;
cout << "Enter the customer's first name: " << endl;
cin >> customerName;
cout << "\n Enter customers surname: " << endl;
cin >> customerSurname;
cout << "\n The length of the room: " << endl;
cin >> length;
cout << "\n Enter the width of the room: " << endl;
cin >> width;
cout << "\n Enter the carpet selling price: " << endl;
cin >> sellingPrice;
int printCustomerStatement;
{
cout << "\n Customer name : " << endl;
cin >> customerName >> customerSurname ;
cout << "Customer number : " << endl;
cin >> customerNumber;
cout << "\n Carpet price : " << endl;
cin >> carpetPrice;
cout << "Labour : " << endl;
cin >> labour;
cout << "\n Subtotal : " << endl;
cin >> carpetPrice;
cout << "Less Discount : " << endl;
cin >> qualifyForDiscount;
cout << "\n Subtotal: " <<endl;
cin >> carpetPrice;
cout << "Plus tax: " << endl;
cin >> salesTax;
cout << "Total: " << endl;
cin >> carpetPrice;
}
return 0;
}