matthewking
Programmer
Hi all,
Ive developed this code for a college assignment, however when I try to compile I get the following error:
(255) : warning C4091: '' : ignored on left of 'float' when no variable is declared
c:\documents and settings\matthew\desktop\electric.cpp(277) : error C2059: syntax error : ')'
Error executing cl.exe.
ELECTRIC.OBJ - 1 error(s), 4 warning(s)
Please could you take a quick look at the code, Its something to do with the vatAmt float variable. Thanks in advance.
Heres the code, both errors are at the bottom of the code, ive marked them out.
===========================================
#include <stdio.h>
#include <conio.h>
#include <string.h>
#define VatAmt
#define billAmt
/*******************************************************************************************/
/* function WelcomeScreen */
/*******************************************************************************************/
void WelcomeScreen (int *BatchSize)
// This module displays a user friendly welcome screen. the module also
// prompts for and inputs the number of Electric bills to be processed
{
char ReadCMR;
// clrscr();
printf( "*************************************************************************" );
printf( "\n* Welcome To The Process Electric Bills *" );
printf( "\n\n" );
printf( "*This program will process Electric Billfor customer's*" );
printf( "\n\n" );
printf( "* The program will prompt the user for the BatchSize *"
printf( "\n i.e. the number of Electric Bills to process *" );
printf( "\n************************************************************************" );
//gotoxy( 15,10 );
printf("Please enter BatchSize"
printf("%d%c", BatchSize);
//gotoxy(15,15);
printf( "Press enter to continue " );
scanf( "%c"
printf( "\nAT the END of WelcomeScreen" );
}
/*******************************************************************************************/
/* function EnterBillDetails */
/*******************************************************************************************/
void *Enterdetailbills (int LoopCounter, char ReferenceNumber, char CustomerName,
int hoNum, char stName, int &CMR, int &LMR, int &UnitUsed)
{
// This module prompts for and input information relating to the Bill. For each
// Electric bill, the module will prompt for and input the Customer reference number,
// Customer name, Customer type and Units used. This module also calculates the
// total number of units used by Domestic customers and total number of units used
// by Business users
//char CMR;
//clrscr();
//gotoxy (10,5);
printf( "For Electric Bill number: %d", (LoopCounter) );
//gotoxy( 10,6 );
printf( "Please enter Customers ReferenceNumber --> " );
scanf( "%s%c", ReferenceNumber);
// gotoxy( 10,7 );
printf( "Please enter CustomerName --> " );
scanf ( "%s%c", CustomerName );
// gotoxy( 10,8 );
printf( "Please type customer house number " );
scanf ( "%u%", hoNum );
// gotoxy( 10,9 );
printf( "Please type customer street name " );
scanf ("%s%c", stName);
// gotoxy( 10,10 );
printf( "Please type Curent Meter Reading " );
scanf("%d", CMR );
// gotoxy( 10,11 );
printf( "Please type customer LMR " );
scanf("%d", &LMR );
// gotoxy( 10,12 );
printf( "Please enter number of UnitsUsed by customer --> " );
scanf( "%d%c", UnitUsed );
// gotoxy( 10,13 );
printf( "Press enter to continue... " );
// scanf( "%c", &ReadCR );
return 0;
}
/*******************************************************************************************/
/* function CalculateElectricBill */
/*******************************************************************************************/
void *CalculateElectricBill (char CustomerName, int *AmtCharged, int *VatAmt,int &UnitUsed)
// This module calculates the Amount charged for each electric bill.
// This module also calculates the total amount charged to business users
// and the total amount charged to domestic users
{
if(CustomerName =='B')
{
*AmtCharged=UnitUsed;
/* *VatAmt=*AmtCharged;*/
}
else
{
*AmtCharged=UnitUsed;
/* *VatAmt=*AmtCharged; */
}
return 0;
}
/*******************************************************************************************/
/* function CustomerReport */
/*******************************************************************************************/
void *CustomerReport( char ReferenceNumber, char CustomerName,
int UnitUsed, int AmtCharged)
{
// This module displays a report for each customerls Electric bill
char ReadCR;
int Rate;
// clrscr();
printf( "*****************************************************************************" );
printf( "\n* Electric Bill Details *" );
printf( "\n\n" );
printf( "* Below is a report showing the Electric bill details for a customer *" );
printf( "\n\n" );
printf( "*****************************************************************************" );
// gotoxy( 5,8 );
printf( "CustomerReferenceNumber.... %c",ReferenceNumber);
// gotoxy( 10,11 );
printf( "CustomerName................%s",CustomerName);
// gotoxy( 10,12 );
printf( "hoNum"
// gotoxy( 10,13);
printf( "stName"
// gotoxy ( 10,14);
printf( "Amount Charged details:" );
// gotoxy( 10,16 );
printf( "Number of units used........... %d",UnitUsed);
// gotoxy( 10,17 );
printf( "Charge rate.................... " );
// gotoxy( 10,18 );
printf( "Cost of Electric Bill............... %d",AmtCharged);
// gotoxy( 1,21 );
printf( "Press enter to continue... " );
scanf( "%c" );
return 0;
}
/*******************************************************************************************/
/* function Report */
/*******************************************************************************************/
void BatchReport( int &UnitUsed, int &BillAmt, int &BatchSize)
{
// This module displays the Batch report
char ReadCR;
printf( "*****************************************************************************\n"
printf( " Reprt Details \n *" );
printf( " Below is a report showing details \n *" );
printf( "\n\n" );
printf( "*****************************************************************************" );
// gotoxy( 5,8 );
printf( "Total UnitUsed:" );
printf("%d"
// gotoxy( 10,10 );
printf( " Total BillAmt"
printf("%d"
// gotoxy( 10,11 );
// gotoxy( 5,14 );
printf( "BatchSize" );
printf( "%d"
// gotoxy( 10,16 );
printf( "By Customer name"
printf("%s"
// gotoxy( 10,17 );
// gotoxy( 1,21 );
printf( "Press enter to continue... " );
scanf( "%c", &ReadCR );
/* return 0; */
}
/*******************************************************************************************/
/* function ExitScreen */
/*******************************************************************************************/
void ExitScreen()
// This module displays a user friendly Exit screen
{
char ReadCR;
// clrscr();
printf( "*****************************************************************************" );
printf( "\n* THANK YOU FOR USING THE ProcessElectricBills PROGRAM *" );
printf( "\n\n" );
printf( "* This program will now terminate *" );
printf( "\n\n" );
printf( "*****************************************************************************" );
// gotoxy( 1,10 );
printf( "Press enter to continue... " );
scanf( "%c", &ReadCR );
}
/*******************************************************************************************/
/* main program */
/*******************************************************************************************/
int main(void)
{
int BatchSize; /*(7)*/;
char ReferenceNumber; /*(7);*/ /* Customer referencenumber */
char CustomerName; /*(25);*/ /* Customers name */
char hoNum; /*(13);*/
char stName; /*(25);*/
int CMR; // Current Meter Reading
int LMR; // Last Meter Reading
int UnitUsed; /* Number of units used by the customer */
float BillAmt; /* The amount charged for the electric bill */
float VatAmt;
========================================================
the above line gets the following:
(255) : warning C4091: '' : ignored on left of 'float' when no variable is declared
=========================================================
float totalBillAmt;
int LoopCounter;
WelcomeScreen( &BatchSize);
for( LoopCounter = 1; LoopCounter <=BatchSize; LoopCounter++)
{
// Enterdetailbills( LoopCounter, BatchSize, ReferenceNumber, CustomerName, &CMR, &LMR
// &UnitUsed);
// CalculateElectricbill(BillAmt,UnitUsed,VatAmt);
// CustomerReport( ReferenceNumber, CustomerName,
// UnitsUsed, BillAmt );
}
============================================================
when calling this method, I also get this error:
(277) : error C2059: syntax error : ')'
============================================================
BatchReport( UnitUsed, BillAmt, VatAmt );
ExitScreen();
return(0);
}
Ive developed this code for a college assignment, however when I try to compile I get the following error:
(255) : warning C4091: '' : ignored on left of 'float' when no variable is declared
c:\documents and settings\matthew\desktop\electric.cpp(277) : error C2059: syntax error : ')'
Error executing cl.exe.
ELECTRIC.OBJ - 1 error(s), 4 warning(s)
Please could you take a quick look at the code, Its something to do with the vatAmt float variable. Thanks in advance.
Heres the code, both errors are at the bottom of the code, ive marked them out.
===========================================
#include <stdio.h>
#include <conio.h>
#include <string.h>
#define VatAmt
#define billAmt
/*******************************************************************************************/
/* function WelcomeScreen */
/*******************************************************************************************/
void WelcomeScreen (int *BatchSize)
// This module displays a user friendly welcome screen. the module also
// prompts for and inputs the number of Electric bills to be processed
{
char ReadCMR;
// clrscr();
printf( "*************************************************************************" );
printf( "\n* Welcome To The Process Electric Bills *" );
printf( "\n\n" );
printf( "*This program will process Electric Billfor customer's*" );
printf( "\n\n" );
printf( "* The program will prompt the user for the BatchSize *"
printf( "\n i.e. the number of Electric Bills to process *" );
printf( "\n************************************************************************" );
//gotoxy( 15,10 );
printf("Please enter BatchSize"
printf("%d%c", BatchSize);
//gotoxy(15,15);
printf( "Press enter to continue " );
scanf( "%c"
printf( "\nAT the END of WelcomeScreen" );
}
/*******************************************************************************************/
/* function EnterBillDetails */
/*******************************************************************************************/
void *Enterdetailbills (int LoopCounter, char ReferenceNumber, char CustomerName,
int hoNum, char stName, int &CMR, int &LMR, int &UnitUsed)
{
// This module prompts for and input information relating to the Bill. For each
// Electric bill, the module will prompt for and input the Customer reference number,
// Customer name, Customer type and Units used. This module also calculates the
// total number of units used by Domestic customers and total number of units used
// by Business users
//char CMR;
//clrscr();
//gotoxy (10,5);
printf( "For Electric Bill number: %d", (LoopCounter) );
//gotoxy( 10,6 );
printf( "Please enter Customers ReferenceNumber --> " );
scanf( "%s%c", ReferenceNumber);
// gotoxy( 10,7 );
printf( "Please enter CustomerName --> " );
scanf ( "%s%c", CustomerName );
// gotoxy( 10,8 );
printf( "Please type customer house number " );
scanf ( "%u%", hoNum );
// gotoxy( 10,9 );
printf( "Please type customer street name " );
scanf ("%s%c", stName);
// gotoxy( 10,10 );
printf( "Please type Curent Meter Reading " );
scanf("%d", CMR );
// gotoxy( 10,11 );
printf( "Please type customer LMR " );
scanf("%d", &LMR );
// gotoxy( 10,12 );
printf( "Please enter number of UnitsUsed by customer --> " );
scanf( "%d%c", UnitUsed );
// gotoxy( 10,13 );
printf( "Press enter to continue... " );
// scanf( "%c", &ReadCR );
return 0;
}
/*******************************************************************************************/
/* function CalculateElectricBill */
/*******************************************************************************************/
void *CalculateElectricBill (char CustomerName, int *AmtCharged, int *VatAmt,int &UnitUsed)
// This module calculates the Amount charged for each electric bill.
// This module also calculates the total amount charged to business users
// and the total amount charged to domestic users
{
if(CustomerName =='B')
{
*AmtCharged=UnitUsed;
/* *VatAmt=*AmtCharged;*/
}
else
{
*AmtCharged=UnitUsed;
/* *VatAmt=*AmtCharged; */
}
return 0;
}
/*******************************************************************************************/
/* function CustomerReport */
/*******************************************************************************************/
void *CustomerReport( char ReferenceNumber, char CustomerName,
int UnitUsed, int AmtCharged)
{
// This module displays a report for each customerls Electric bill
char ReadCR;
int Rate;
// clrscr();
printf( "*****************************************************************************" );
printf( "\n* Electric Bill Details *" );
printf( "\n\n" );
printf( "* Below is a report showing the Electric bill details for a customer *" );
printf( "\n\n" );
printf( "*****************************************************************************" );
// gotoxy( 5,8 );
printf( "CustomerReferenceNumber.... %c",ReferenceNumber);
// gotoxy( 10,11 );
printf( "CustomerName................%s",CustomerName);
// gotoxy( 10,12 );
printf( "hoNum"
// gotoxy( 10,13);
printf( "stName"
// gotoxy ( 10,14);
printf( "Amount Charged details:" );
// gotoxy( 10,16 );
printf( "Number of units used........... %d",UnitUsed);
// gotoxy( 10,17 );
printf( "Charge rate.................... " );
// gotoxy( 10,18 );
printf( "Cost of Electric Bill............... %d",AmtCharged);
// gotoxy( 1,21 );
printf( "Press enter to continue... " );
scanf( "%c" );
return 0;
}
/*******************************************************************************************/
/* function Report */
/*******************************************************************************************/
void BatchReport( int &UnitUsed, int &BillAmt, int &BatchSize)
{
// This module displays the Batch report
char ReadCR;
printf( "*****************************************************************************\n"
printf( " Reprt Details \n *" );
printf( " Below is a report showing details \n *" );
printf( "\n\n" );
printf( "*****************************************************************************" );
// gotoxy( 5,8 );
printf( "Total UnitUsed:" );
printf("%d"
// gotoxy( 10,10 );
printf( " Total BillAmt"
printf("%d"
// gotoxy( 10,11 );
// gotoxy( 5,14 );
printf( "BatchSize" );
printf( "%d"
// gotoxy( 10,16 );
printf( "By Customer name"
printf("%s"
// gotoxy( 10,17 );
// gotoxy( 1,21 );
printf( "Press enter to continue... " );
scanf( "%c", &ReadCR );
/* return 0; */
}
/*******************************************************************************************/
/* function ExitScreen */
/*******************************************************************************************/
void ExitScreen()
// This module displays a user friendly Exit screen
{
char ReadCR;
// clrscr();
printf( "*****************************************************************************" );
printf( "\n* THANK YOU FOR USING THE ProcessElectricBills PROGRAM *" );
printf( "\n\n" );
printf( "* This program will now terminate *" );
printf( "\n\n" );
printf( "*****************************************************************************" );
// gotoxy( 1,10 );
printf( "Press enter to continue... " );
scanf( "%c", &ReadCR );
}
/*******************************************************************************************/
/* main program */
/*******************************************************************************************/
int main(void)
{
int BatchSize; /*(7)*/;
char ReferenceNumber; /*(7);*/ /* Customer referencenumber */
char CustomerName; /*(25);*/ /* Customers name */
char hoNum; /*(13);*/
char stName; /*(25);*/
int CMR; // Current Meter Reading
int LMR; // Last Meter Reading
int UnitUsed; /* Number of units used by the customer */
float BillAmt; /* The amount charged for the electric bill */
float VatAmt;
========================================================
the above line gets the following:
(255) : warning C4091: '' : ignored on left of 'float' when no variable is declared
=========================================================
float totalBillAmt;
int LoopCounter;
WelcomeScreen( &BatchSize);
for( LoopCounter = 1; LoopCounter <=BatchSize; LoopCounter++)
{
// Enterdetailbills( LoopCounter, BatchSize, ReferenceNumber, CustomerName, &CMR, &LMR
// &UnitUsed);
// CalculateElectricbill(BillAmt,UnitUsed,VatAmt);
// CustomerReport( ReferenceNumber, CustomerName,
// UnitsUsed, BillAmt );
}
============================================================
when calling this method, I also get this error:
(277) : error C2059: syntax error : ')'
============================================================
BatchReport( UnitUsed, BillAmt, VatAmt );
ExitScreen();
return(0);
}