| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1006 人关注过本帖
标题:程序出错了?!
取消只看楼主 加入收藏
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
快速回复:程序出错了?!
数据加载中...
 
   



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

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