标题:程序出错了?!
取消只看楼主
jack333fly
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2010-7-15
结帖率:83.33%
已结贴  问题点数:5 回复次数:2 
程序出错了?!
#include <iostream>
using namespace std;
void get(double& price, int& turnover);
double cost(double price, int turnover);
void show_output(double price, int turnover, double cost);
const int THRESHORD = 7;
const int low = 0.05;
const int high = 0.10;
int main()
{
    double cost1, price;
    int turnover;
    get(price, turnover);
    cost1 = cost(price, turnover);
    show_output(price, turnover, cost1);
    return 0;
}
void get(double& price, int& turnover)
{
    cout << "Please enter price and turnover:" << endl;
    cin >> price >> turnover;
    return;
}
double cost(double price, int turnover)
{
    if (turnover <= THRESHORD)
        return(price + price * low);
    else
        return(price + price * high);
    return;
}
void show_output(double price, int turnover, double cost)
{
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(2);
    cout << "The cost for price " << price << endl
         << "and turnover " << turnover << endl
         << "is:" << cost << endl;
    return;
}
搜索更多相关主题的帖子: void include double return price 
2010-07-19 10:35
jack333fly
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2010-7-15
得分:0 
回复 2楼 雅雅
就是写一个程序来判定商品价格cost,已知进价price和存放天数turnover,如果小于等于七天的话就加5%,如果大于七天就加10%……
2010-07-19 13:52
jack333fly
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2010-7-15
得分:0 
回复 3楼 gq198718
好像还是不行啊~~~
2010-07-19 13:53



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-313388-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.094796 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved