| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 683 人关注过本帖
标题:小程序,哪里错了?
取消只看楼主 加入收藏
ddc
Rank: 2
等 级:新手上路
威 望:3
帖 子:23
专家分:0
注 册:2008-9-9
收藏
 问题点数:0 回复次数:0 
小程序,哪里错了?
#include <stdio.h>
#define PI 3.14159
main()
{
    float circum,totalcost,no;
    circum=area();
    totalcost=cost(circum,cost,no);
    printf("Total cost is %f\n",totalcost);
}

float area(float r, float h)
{
    printf("Input Radius:");
    scanf("%f",r);
    printf("Input Height:");
    scanf("%f",h);
    printf("Circumference of a container is %f",PI*r*r+h*2*PI*r);
    return(PI*r*r+h*2*PI*r);
}
float cost(float circum,float totalcost,float no)
{
    printf("Input Quantity:");
    scanf("%f",&no);
    printf("Input cost per cm^2:");
    scanf("%f",&cost);
    printf("Cost of each container is %f\n",circum*cost);
    totalcost=circum*cost*no;
    return(totalcost);
}

定义两个函数,area涌来计算圆柱体的表面积,cost函数计算每个圆柱体的花费和总花费,
函数调用我不怎么熟悉,请问哪里错了?谢谢。
搜索更多相关主题的帖子: include return 
2008-10-08 17:01
快速回复:小程序,哪里错了?
数据加载中...
 
   



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

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