Write a program that uses a function to compute the cost of a pizza with given diameter and the number of toppings. Constant will be the cost per toppings and cost per square inch. It will contain a reputable structure as well.
diameter=17
number of toppings=3
cout<<"Do you have another pizza to process <Y or N>?\t";
cin>>Another;
if((Another=='Y')||(Another=='y'));
{
system("PAUSE");
system("CLS");
}//end of if
}while((Another=='Y')||(Another=='y'));
//end of while
return 0;
}//end of main
//function defination
//function heading
float ComputePizzaCost(int Diameterf, int NumberOfToppingsf)
{
//local identenfiers
float Area,Radius,PieCost, ToppinsCost, TotalCost;
Radius=float(Diameterf)/2;
Area=PI*pow(Radius,2);
PieCost=Area*COST_PER_SQ_IN;
ToppingsCost=NumberOfToppingsf*COST_PER_TOPPINGS;
TotalCost=PieCost+ToppingsCost;
return TotalCost;
}//end function ComputePizzaCost
I tried to run it but there is something wrong.
Can anyone please help me solve this please.
before
cout<<"Do you have another pizza to process<Y or N>?\t";
I think some processing data needs to be there to process an output.
But I don't know what to do?
it could be this. .in your prototype and the definition the parameters have an f, Diameterf and NumberOfToppingsf.. in the call they don't.. you can try correct that see it it works..