i am having trouble with the divide function in the main. any help would be great.
Code:#include <iostream> #include "fun.h" using namespace std; double divide (double num1, double num2); int main() { double a, b, c; //declares variables cout<<"Enter two numbers:"; //displays output cin>>a>>b; //gets input cout<<endl; //ends line /************************************** * Adds the value of a and b * * @param a a double * * @param b a double * * @return the sum of the two inputs* **************************************/ c=add(a,b); cout<<"The sum of the two numbers is: " <<c; cout<<endl; /*************************************** * Subtracts the value of a and b * * @param a a double * * @param b a double * * @return the diff of the two inputs* ***************************************/ c=subtract(a,b); cout<<"The difference of the two numbers is: " <<c; cout<<endl; /****************************************** * Mutiplies the value of a and b * * @param a a double * * @param b a double * * @return the product of the two inputs* ******************************************/ c=multiply(a,b); cout<<"The product of the two numbers is: " <<c; cout<<endl; /*************************************** * Cubes the value of a and b * * @param a a double * * @param b a double * * @return the cube of one input * ***************************************/ c=cube(a); cout<<"The cube of the first number is: " <<c; cout<<endl; /*************************************** * Cubes the value of a and b * * @param a a double * * @param b a double * * @return the cube of one input * ***************************************/ c=cube(b); cout<<"The cube of the second number is: " <<c; cout<<endl; double divide (double num1, double num2) { double total; total = num1 / num2; return total; } return 0; }



LinkBack URL
About LinkBacks



Just to clarify.