输出只是黑屏。我的代码中有错误吗? [英] Output is nothing but black screen. Are there any errors in my code?
本文介绍了输出只是黑屏。我的代码中有错误吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< embed height =" 0" ID = QUOT; xunlei_com_thunder_helper_plugin_d462f475-C18E-46be-bd10-327458d045bd"类型= QUOT;应用/ thunder_download_plugin"宽度= QUOT; 0" />
<embed height="0" id="xunlei_com_thunder_helper_plugin_d462f475-c18e-46be-bd10-327458d045bd" type="application/thunder_download_plugin" width="0" />
#include <iostream>
#include <iomanip>
using namespace std;
void main()
{
// Declare all the variables
// set total to zero
int custID;
int sales_amount;
int discount_rate;
int net_sales;
char reply='E;
int total=0;
//while (!((reply!= 'E') || (reply !='e')))
while ((toupper(reply))!= 'E')
{
// Prompt user to enter the customer ID,
// read customer ID
cout << "Enter the custID: ";
cin >> custID;
// prompt user to enter sales amount
// read sales amount
cout << "Enter the sales amount: ";
cin >> sales_amount;
// prompt user to enter discount rate
// read discount rate
cout << "Enter discount: ";
cin >> discount_rate;
// if sale amount > 10000 then
if (sales_amount>10000){
// calculate net sales amount using formula
net_sales = ( 1 - discount_rate /100 ) * sales_amount;
// accumulate net amount
total += net_sales;
} // endif
// Print "Press ‘E’ to exit, others to continue" message
cout << "Enter 'E' to exit, any other character to continue...";
cin >> reply;
// displays the total net amount with 2 decimal places
cout<<fixed<<setprecision(2)<<"Total net amount: "<<total<<endl;
cout<<"Press any key to continue…"<<endl;
// read reply
cin>> reply;
} while (toupper(reply)!='E'); //end of while loop
cin.ignore();
cin.ignore();
}
推荐答案
单步执行代码行在调试器中按行。 你找到了什么?
Step through the code line by line in the debugger. What do you find?
这篇关于输出只是黑屏。我的代码中有错误吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文