高手帮下忙呀!编译器发出警告打不开graph.h文件
/*---------------------------------------------Billing Log:Compute and print the daily billing log for action advertising
Program: chapter4.c
Author: yihun
Date:january 25 in 2010
Project:sample program
********************************************/
/*----------------PREPROCESSING DIRECTIVES-----------------*/
#include <stdio.h>
#include <string.h>
#include <graph.h>
/*-------------FUNCTION PROTOTYPES--------------------------*/
void PrnHeadings(void); /*print heading*/
void ProcessLoop(void); /*process loop*/
void InputName(void); /*input name*/
void InputBillData(void); /*input billing date*/
float CalcBill(void); /*calculate the cilent bill*/
void PrnDetail(float); /*print detail line*/
float CalcAverBill(float); /*calculate averge bill*/
void PrnTotals(float,float); /*print the total line*/
/*------------------pragram setup-------------------*/
/*> REPORT TITLES AND HEADINGS <*/
char PT1 []=" A C T I O N A D V E R T I S I N G ";
char PT2 []=" Daily Billing Log ";
char HT1 []=" Time spent Hourly Daily ";
char HT2 []=" Account on Account Charge Bill ";
char TL1 []="Total Daily Billing: $";
char TL2 []="Averge Daily Billing: $";
/*> PRAGRAM VARIABLES <*/
char sName [18]; /*client name */
float fTime; /*time spent on account*/
float fCharge; /*charge for work*/
int iCount; /*number of clients*/
/*----------------------------------------------------
MAINING CONTROL
----------------------------------------------------*/
main()
{
PrnHeadings(); /*print report headings*/
ProcessLoop(); /*processing loop*/
return 0;
}
/*-----------------------------------------------------
PRINT REPORT HEADINGS
-----------------------------------------------------*/
void PrnHeadings(void)
{
fprintf(stdprn,"\r\f"); /*reset to top of page*/
fprintf(stdprn,PT1); /*print page title 1 */
fprintf(stdprn,"\r\n"); /*reset &single space*/
fprintf(stdprn,PT2); /*print page title 2*/
fprintf(stdprn,"\r\n\n\n"); /*reset triple space*/
fprintf(stdprn,HT1); /*print heading line*/
fprintf(stdprn,"\r\n"); /*reset &single space*/
fprintf(stdprn,HT2); /*reset &single space*/
return;
}
/*------------------------------------------------------
PROCESSING LOOP
------------------------------------------------------*/
void ProcessLoop(void)
{
float fBill; /*client bill*/
float fTotBill; /*report total bill*/
float fAvrBill; /*report averge bill*/
_clearscreen(0);InputName();
while(strcmp(sName,"stop")!=0 )
{
InputBillData;
fBill=CalcBill();
fTotBill=fTotBill+fBill;
PrnDetail(fBill);
-clearscreen(0);
InputName();
}
fAvrBill=CalcAvrBill(fTotBill);
PrnTotals(fTotBill,fAvrBill);
return;
}
/*---------------------------------------------------------
INPUT CLIENT NAME
------------------------------------------------------*/
void InputName(void)
{
printf("\n\nEnter client or 'stop' to Qiut:");
scanf("%[^\n]",sName);
fflush(stdin);
return;
}
/*-----------------------------------------------------------
INPUT BILLING DATA
--------------------------------------------------------*/
void InputBillData(void)
{
printf(" Enter time spent on accout:" );
scanf("%f", &fTime);
printf(" Enter hourly charge:");
scanf("%f",&fCharge);
fflush(stdin);
return;
}
/*---------------------------------------------------------
CALCULATE BILL
----------------------------------------------------------*/
float CalcBill(void)
{
float fBill;
iCount++;
fBill=fTime*fCharge;
return fBill;
}
/*-----------------------------------------------------------
PRINT DFTAIL LINE
-----------------------------------------------------*/
void PrnDetail(float fBill)
{
fprintf(stdprn,"\r\n%-15s %4.1f %6.2f %7.2f",
sName, fTime,fCharge,fBill);
return;
}
/*-----------------------------------------------------------
CALCULATE AVERGE BILL
------------------------------------------------------------*/
float CalcAvrBill(float fTotBill)
{
float fAvrBill;
fAvrBill=fTotBill/iCount;
return fAvrBill;
}
/*------------------------------------------------------------
PRINT TOTAL LINES
--------------------------------------------------------------*/
void PrnTotals(float fTotBill,float fAvrBill)
{
fprintf(stdprn,"\r\n\n%-35s%7.2f",TL1,fTotBill);
fprintf(stdprn,"\r\n%-35s%7.2f\r", TL2,fAvrBill);
return;
}