Tuesday, July 14, 2009

What is wrong with this code ? its c++?

#include %26lt;iomanip%26gt;


#include %26lt;iostream%26gt;


#include %26lt;fstream%26gt;


using namespace std;


int main()


{


float costtotal,totalcost=0;


int ordercount,I=0;


float averagecost,avg;


void determinecost (float,int,float%26amp;,int%26amp;);


determinecost(totalcost,I,totalcost%26amp;,I%26amp;)...


costtotal = totalcost;


ordercount = I;


void calcaverage(float,int,float%26amp;);


averagecost=calcaverage(costtotal,orderc...


ofstream outfile ("a:\\PIZZACOST.txt");


outfile%26lt;%26lt;setw(20)%26lt;%26lt;"The Average cost is: "%26lt;%26lt;setprecision(4)%26lt;%26lt;showpoint;


outfile%26lt;%26lt;dec%26lt;%26lt;averagecost%26lt;%26lt;"\n";


cout%26lt;%26lt;"DONE......Check file";


return 0;


}


void determinecost (float totalcost,int I,float%26amp; totalcost, int%26amp; I)


{





int totalpizzaorders = 0;


int totallargepizzas = 0;


int totalmediumpizzas = 0;


int totalsmallpizzas = 0;


int accnum;


char pizzasize;


char pizzatype;


float cost;


ifstream infile("a:\\PIZZAORDER.txt");


ofstream outfile ("a:\\PIZZACOST.txt);

What is wrong with this code ? its c++?
you havn't closed "void determinecost (...)" function with curly braces " } "





in c++, you have to close any block of code with } that has been opened with {
Reply:Adding the compiler error message would make answering the question much easier too!





But yes, the final curly brace does appear to be missing - unless you simply missed copying it.


No comments:

Post a Comment