是不是编译器惹的祸呀???
*--------------------------------------------------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;
}输的和书上的一样,但是却出现: