function not printing result in menu program

Program is meant to allow the user to make several menu choices and print a total once they're done. Discount price is applied for items in multiple of two thus the if/else statement. Currently the menu selections [appear to] work, but selecting 5 simply terminates the program with no output. Any hints on where I'm going wrong here? Thanks in advance.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

// constants for pricing
const double SINGLE = 3.59,
               PAIR = 5.99;
    
// prototypes
void showMenu();
void orderTotal(float& total);


int main() {
// constants for pricing
const double SINGLE = 3.59,
             PAIR = 5.99;


// variables
int choice, 
    qty=0,
    qty1=0,
    qty2=0, 
    qty3=0,
    qty4=0;
double total, subtotal;

cout << fixed << setprecision(2);


do{
    showMenu();
    cout << "Please make a selection: \n";

// get selection
cin >> choice;


switch(choice)
{
    case 1: cout << "You've selected Turkey Corn Dog.\n";
            cout << "How many would you like? \n";
            cin >> qty1;
            break;
            
    case 2: cout << "You've selected Beef Corn Dog.\n";
            cout << "How many would you like? \n";
            cin >> qty2;
            break;
            
    case 3: cout << "You've selected Pepper Jack Cheese Stick\n";
            cout << "How many would you like? \n";
            cin >> qty3;
            break;
            
    case 4: cout << "You've selected American Cheese Stick\n";
            cout << "How many would you like? \n";
            cin >> qty4;
            break;

    case 5: 
        void orderTotal(float qty1, float qty2, float qty3, float qty4);
        
        return 0;
        
    }
}
 while (choice >=1 && choice <=5);    

    
}

void showMenu(){
    cout << "**********************************\n"
        "** Welcome to Hotdog on a Stick ** \n"
        "**********************************\n"
        "All items are $3.59, or 2 for $5.99! \n"
        "Menu: \n"
        "(1) Turkey Corn Dog\n"
        "(2) Beef Corn Dog\n"
        "(3) Pepper Jack Cheese Stick\n"
        "(4) American Cheese Stick\n"
        "(5) Finish and Pay\n";

}
void orderTotal(float qty1, float qty2, float qty3, float qty4){
    float qty, subtotal, total;
    qty = qty1+qty2+qty3+qty4;
        if ((fmod(qty,2)) == 0) {
        subtotal = (qty * PAIR) / 2;
        total = subtotal + subtotal * .0875;
        cout << "Your ordered " << qty << 1 << "\n";
        cout << "Your total is $" << total << "\n";
      
        }
        
        else if ((fmod(qty,2)) == 1){
        subtotal = (((qty-1) * PAIR) / 2) + SINGLE;
        total = subtotal + subtotal * .0875;
        cout << "Your total is $" << total << "\n";
        
        }
}
in line 65 you are calling the fucntion wrong

 
orderTotal(float qty1, float qty2, float qty3, float qty4);


remove the void, that is not how you call functions
Last edited on
Good catch, unfortunately now I'm getting the error "expected primary-expression before 'float'" for line 65. Any ideas there? Tried fiddling around with it but so far no luck.
See http://www.cplusplus.com/doc/tutorial/functions/ for examples of how to call functions.
Something just isn't clicking with me. I've read through that link a couple times, watched a couple videos and still nothing.
Another basic tutorial on function parameters and arguments:
https://www.learncpp.com/cpp-tutorial/introduction-to-function-parameters-and-arguments/
The function prototype on L13 doesn't match the function definition on L89.

Also as mentioned above, L65 should be:

 
orderTotal(qty1, qty2, qty3, qty4);

Topic archived. No new replies allowed.