Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/139.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 无法解析对重载函数的引用;你想叫它吗?_C++_Variables_If Statement - Fatal编程技术网

C++ 无法解析对重载函数的引用;你想叫它吗?

C++ 无法解析对重载函数的引用;你想叫它吗?,c++,variables,if-statement,C++,Variables,If Statement,问题描述:大学书店每年10月24日都有千字节的大减价,如果价格低于128美元,购买所有电脑配件可以享受8%的折扣,如果价格至少为128美元,可以享受16%的折扣。编写一个程序,询问出纳原始价格,然后打印折扣价格 我正在努力解决这个问题。第24行有错误 #包括 使用名称空间std; int main() { 双倍原价; 双重贴现率; 双折价格; 没有原价; //cout下面这条线的形状不好: double discounted_price = discount_rate * original_

问题描述:大学书店每年10月24日都有千字节的大减价,如果价格低于128美元,购买所有电脑配件可以享受8%的折扣,如果价格至少为128美元,可以享受16%的折扣。编写一个程序,询问出纳原始价格,然后打印折扣价格

我正在努力解决这个问题。第24行有错误


#包括
使用名称空间std;
int main()
{ 
双倍原价;
双重贴现率;
双折价格;
没有原价;

//cout下面这条线的形状不好:

double discounted_price = discount_rate * original_price<<endl;

这将计算折扣价格,然后使用用于添加换行符和刷新标准输出流的
std::endl
打印它。

好得多,但您仍然将
endl
放在错误的位置

double discounted_price = discount_rate * original_price<<endl;
cout << "discounted_price: "<< discounted_price;

双倍折扣价格=折扣率*原价该标题用于总结您的问题,而不是说明您有问题。如果您询问错误,请提供编译器/程序输出。无需读者猜测。谢谢。
endl
是函数,因此未解析的函数类型出错。
endl
添加换行符和刷新。插入
“\n”
将启动新行。
double discounted_price = discount_rate * original_price;
cout << "discounted_price: "<< discounted_price << endl;
double discounted_price = discount_rate * original_price<<endl;
cout << "discounted_price: "<< discounted_price;
double discounted_price = discount_rate * original_price;
cout << "discounted_price: "<< discounted_price << endl;