446,192 Members | 811 Online
Need help? Post your question and get tips & solutions from a community of 446,192 IT Pros & Developers. It's quick & easy.

# Error compiling (function call?)

 P: 4 Hi. I'm Alize. I'm taking Intro to Programming C++. I enjoy this class but sometimes I'm really bad with the programming I just cannot believe why do I do silly mistake. Here are the instructions I've written for a question below Winning Division This program should calculate which division in a company had the greatest sales for a quarter. It should use the following functions: 1. A function should ask the user for and return the quarterly sales figures for the company's Northeast, Southeast, Northwest, and Southwest divisions. 2. A function should determine which division had the highest sales figures. A message should be displayed indicating the leading division and its sales figures for the quarter. Input Validation: Do not accept dollar amounts less than \$0.00. My instructions are as follows: Expand|Select|Wrap|Line Numbers #include  #include    using namespace std;   //Function Prototypes.     void findHighest(float nE, float sE, float nW, float sW);       int main() {   // For cin command.        float nE, sE, nW, sW;       nE = input_div( "North East" );         sE = input_div( "South East" );         nW = input_div( "North West" );         sW = input_div( "South West" );       // To print Results      findHighest(nE, sE, nW, sW);       return 0;     } **************************************************************************************     float input_div (nE, sE, nW, sW)     float sales; { do { // Get the sales for each division.    cout << "Enter the sales for " << North East << "Division: \n";    cin >> sales;    cout << "Enter the sales for " << South East << "Division: \n";    cin >> sales;    cout << "Enter the sales for " << North West << "Division: \n";    cin >> sales;    cout << "Enter the sales for " << North West << "Division: \n";    cin >> sales; } // Validate the Input. while (sales < 0) {    cout << "Amount cannot be less than \$0.00, please try again: \n";    cin >> sales; } **************************************************************************************    void findHighest() {       float highest, nE, sE, nW, sW;    string name;    highest = nE     name = "North East";   if (sE > highest) { highest = sE; name = "South East"; } if (nW > highest) {  highest = nW; name = "North West"; } if (sW > highest) {  highest = sW; name = "South West"; } cout << "The " << name << " division of the company had the highest "; cout << "sales of \$ " << highest << "."; } return sales;   I cannot compile this program WHYYYY Plz tell me. I've asked the teacher, read the chapter but there's something I don't know it's not clicking I'm so frustrated PLZZZ Experts help me. It's an intro class so the only codes I've used are covered other than that nothing advanced level!! I'd remain thankful to all of u!! Mar 22 '07 #1
4 Replies

 Expert 100+ P: 1,510 for a start you call the function input_div() Expand|Select|Wrap|Line Numbers     nE = input_div( "North East" );       but don't define it Mar 22 '07 #2

 P: 4 for a start you call the function input_div() Expand|Select|Wrap|Line Numbers     nE = input_div( "North East" );       but don't define it Oh thanks. Ok i get this. That's the reason why I'm getting input_div undeclared. But when I try declaring input_div in the function header, it doesn't work. Wat would you suggest declaring it as: I tried: float input_div(); is there a problem still? Mar 22 '07 #3

 Expert 100+ P: 1,510 from the function call Expand|Select|Wrap|Line Numbers     sW = input_div( "South West" );       I would expect the function header to be Expand|Select|Wrap|Line Numbers     float input_div (const char * ch)   however, further down the program you have Expand|Select|Wrap|Line Numbers     float input_div (nE, sE, nW, sW)   you have not specified what type the parameters are? I would guess float & Mar 22 '07 #4

 Expert Mod 2.5K+ P: 4,677 I have changed the title of the thread to better describe the problem. Mar 22 '07 #5