Hello... this is only my second time posting on these boards and yet I am asking for help again. :( I have an assignment I am working on that is supposed to be getting us used to writing functions. I am in my first C++ class so everything to this point is really basic. I am not asking for someone to write this program for me, but only point out the errors I am making with writing my functions and calling them. I keep getting errors about changing "double" type and so forth.

My assignment: in short I am supposed to use already given data to determine the total cost to produce several open-top cylindrical containers. I have to ask the user to input the dimensions and the cost per inch of the material being used, and in return output the surface are for the container and the cost of materials for the container in dollars, all formatted to 2 decimal places. I am also required to ask if they want to input another container and at the very end, display the total cost for all the cylinders entered. I am not sure how to put that into my program... not sure if I need to make some kind of loop with a counter and keep track of the sum or what. So any help there would be appreciated as well! :) My biggest problem is getting the function that does all the computations to work. Sorry to make such a long post but I am going to add in my entire program... its kinda sloppy right now... still just trying to get it to work... but I would really appreciate any help I could get with this! Thank you in advance for your time! =)

Code:

#include <iostream.h>

#include <math.h>

#include <iomanip.h>

//Function Prototype

void program ();

double surface(double, double);

//Main function

int main()

{

//Variable Declarations

int cyl_count;

double radius;

double height;

double volume;

double cost;

double cyl_cost;

char another = 'Y';

//Obtain data from the user

while (another == 'Y')

{

void program ();

cout<<"Enter the radius of the base in inches: "<<endl;

cin>>radius;

cout<<"Enter the height of the container in inches: "<<endl;

cin>>height;

cout<<"Enter the cost per square inch of the material being used in dollars: "<<endl;

cin>>cost;

cout<<"\nTotal surface area for this container is: "<<setprecision(2)

<<setiosflags(ios::fixed | ios:: showpoint)<<surface<<endl;

cyl_cost = cost * surface;

cout<<"\nThe cost of the materials for this container is: "<<setprecision(2)

<<setiosflags(ios::fixed | ios:: showpoint)<<"$"<<cyl_cost<<endl;

cout<<"\nAre there any additional containters to process? Enter Y for yes. "<<endl;

cin>>another;

cyl_count =

}

return 0;

}

//Output program description

void program()

{

cout<<"This program will determine the cost to produce open-top cylindrical containers."<<endl;

return;

}

//Computations

double surface(double radius, double height)

{

double base_area;

double surface_area;

double circumference;

double total_surface_area;

const double PI = 3.14159265;

base_area = PI * pow(radius, 2);

circumference = 2 * PI * radius;

surface_area = circumference * height;

total_surface_area = base_area + surface_area;

return surface;

}

GrlNewB :cool: