| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 445 人关注过本帖
标题:是不是编译器惹的祸呀???
只看楼主 加入收藏
酒精
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2010-1-25
结帖率:100%
收藏
已结贴  问题点数:30 回复次数:4 
是不是编译器惹的祸呀???
*--------------------------------------------------
SALES SUMMARY:For each brach offices,compute and print the yearly sales
figures.


Program:  chapter7
Author:   yichun
Date:     january 26 2010
****************************************************/


/*-----------------PROPROCESSING DIRECTIVE-----------------------*/
#include<stdio.h>



/*----------------FUNCTION PROTOTYPES-----------------------------*/
void PrnHeadings(void)           /*print heading lines*/
void ProcessLoop(void)          /*proesscing loop*/
void InputOffice(void)          /*input office location*/
void InputSales(void)           /*input quarterly sales*/
void PrnYearSales(int)          /*print yearly sales*/


/*----------------PROGRAM VARIABLES------------------------------*/
char sOfficeLoc[6];                  /*office location*/
int iQtrSales;                       /*quarter sales*/


/*----------------MAINING CONTROL----------------------------------*/
main()
{
    PrnHeadings();    /*print heading lines*/
    ProcessLoop();    /*processing loop*/
    return 0;
}


/*--------------------------------------------------------------------
         PRINT HEADING LINES
--------------------------------------------------------------------*/
void PrnHeadings(void)
{
    printf("\nQuarterly sales report");
    printf("\n      january 26");
    return;
}


/*-------------------------------------------------------------------
        PROCESSING  LOOP
---------------------------------------------------------------*/
void ProcessLoop(void)
{
    int iOfc;                               /*office loop control*/
    int iQtr;                               /*quarter loop control*/
    int iYearSales;                         /*yearly sales*/


    for(iOfc=1;iOfc<=3;iOfc++)
    {
    iYearSales=0;
    InputOffice();
    for(iQtr=1;iQtr<=4;iQtr++)
    {
        InputSales();
        iYearSales=iYearSales+iQtrSales;
     }
     PrnYearSales(iYearSales);
     }
}


/*--------------------------------------------------------------
          INPUT OFFICE LOCATION
 ------------------------------------------------------------------*/
 void InputOffice(void)
 {
     printf("\n\tEnter office location")
     scanf("%s",sOfficeLoc);
     fflush(stdin);
     return;
}


/*-----------------------------------------------------------------
          INPUT QUARTERLY SALES
---------------------------------------------------------------------*/
void InputSales(void)
{
    printf("\tEnter quarterly sales");
    scanf("%d",&iQtrSales);
    fflush(stdin);
    return;
}


/*------------------------------------------------------------------
            PRINT YEARLY SALES
---------------------------------------------------------------------*/
void PrnYearSales(int iYearSales)
{
    printf("\n %-5s           $%3d",  sOfficeLoc,iYearSales)
    return;
}输的和书上的一样,但是却出现:
图片附件: 游客没有浏览图片的权限,请 登录注册
搜索更多相关主题的帖子: 编译 
2010-01-26 22:44
fqtb16
Rank: 7Rank: 7Rank: 7
来 自:上海
等 级:黑侠
帖 子:96
专家分:504
注 册:2009-12-28
收藏
得分:5 
你的输入法有没有问题?

爱拼才会赢
2010-01-27 16:26
playmyself
Rank: 5Rank: 5
来 自:第3系4级宇宙空间
等 级:职业侠客
帖 子:76
专家分:399
注 册:2009-7-8
收藏
得分:20 
函数的声明后面一定要加上“;”号。

FUNCTION PROTOTYPES里没没加,还有其它小毛病改好如下:
/*--------------------------------------------------
SALES SUMMARY:For each brach offices,compute and print the yearly sales
figures.


Program:  chapter7
Author:   yichun
Date:     january 26 2010
****************************************************/


/*-----------------PROPROCESSING DIRECTIVE-----------------------*/
#include<stdio.h>



/*----------------FUNCTION PROTOTYPES-----------------------------*/
void PrnHeadings(void);           /*print heading lines*/
void ProcessLoop(void);          /*proesscing loop*/
void InputOffice(void);          /*input office location*/
void InputSales(void);          /*input quarterly sales*/
void PrnYearSales(int);          /*print yearly sales*/


/*----------------PROGRAM VARIABLES------------------------------*/
char sOfficeLoc[6];                  /*office location*/
int iQtrSales;                       /*quarter sales*/


/*----------------MAINING CONTROL----------------------------------*/
main()
{
    PrnHeadings();    /*print heading lines*/
    ProcessLoop();    /*processing loop*/
    return 0;
}


/*--------------------------------------------------------------------
         PRINT HEADING LINES
--------------------------------------------------------------------*/
void PrnHeadings(void)
{
    printf("\nQuarterly sales report");
    printf("\n      january 26");
    return;
}


/*-------------------------------------------------------------------
        PROCESSING  LOOP
---------------------------------------------------------------*/
void ProcessLoop(void)
{
    int iOfc;                               /*office loop control*/
    int iQtr;                               /*quarter loop control*/
    int iYearSales;                         /*yearly sales*/


    for(iOfc=1;iOfc<=3;iOfc++)
    {
    iYearSales=0;
    InputOffice();
    for(iQtr=1;iQtr<=4;iQtr++)
    {
        InputSales();
        iYearSales=iYearSales+iQtrSales;
     }
     PrnYearSales(iYearSales);
     }
}


/*--------------------------------------------------------------
          INPUT OFFICE LOCATION
------------------------------------------------------------------*/
void InputOffice(void)
{
     printf("\n\tEnter office location");
     scanf("%s",sOfficeLoc);
     fflush(stdin);
     return;
}


/*-----------------------------------------------------------------
          INPUT QUARTERLY SALES
---------------------------------------------------------------------*/
void InputSales(void)
{
    printf("\tEnter quarterly sales");
    scanf("%d",&iQtrSales);
    fflush(stdin);
    return;
}


/*------------------------------------------------------------------
            PRINT YEARLY SALES
---------------------------------------------------------------------*/
void PrnYearSales(int iYearSales)
{
    printf("\n %-5s           $%3d",  sOfficeLoc,iYearSales);
    return;
}

[ 本帖最后由 playmyself 于 2010-1-27 18:01 编辑 ]

无聊创造奇迹。
2010-01-27 17:58
cnfarer
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:179
帖 子:3330
专家分:21157
注 册:2010-1-19
收藏
得分:5 
这个应该一般编译器都能通过的.楼上改得对!

★★★★★为人民服务★★★★★
2010-01-27 19:57
酒精
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2010-1-25
收藏
得分:0 
谢谢大家!!!以后自己一定会小心呀!!
2010-01-27 20:51
快速回复:是不是编译器惹的祸呀???
数据加载中...
 
   



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

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