the problem is that when i choose 1 and enter the information when I click enter after price it will show the calculate function information..
quantity = 0 & price = 0
Code:
#include "stdafx.h"
#include <iostream>
#using <mscorlib.dll>
using namespace std;
struct point
{
public:
float quantity;
float price;
};
void get_input(char ,int, float);
float calculate(char, int, float);
int main()
{
int numbinput, quantity;//, calculate;
float price, total;
char product;
do
{
cout << endl << "Enter a number: " << endl;
cout << "1. Enter Information" << endl;
cout << "2. Calculate Sales" << endl;
cout << "3. Update Informaton" << endl;
cout << "4. Exit" << endl <<endl;
cin >> numbinput;
switch (numbinput)
{
case 1:
{
get_input(product, quantity, price);
}
case 2:
{
total = calculate(product, quantity, price);
cout << "The total is: " << total;
}
}
}
while (numbinput != 4);
return 0;
}
void get_input(char product, int quantity, float price)
{
//char product;
//int quantity;
cout << "Product Name: ";
cin >> product;
cout << "Quantity: ";
cin >> quantity;
cout << "Price: ";
cin >> price;
//cout << "Press the spacebar to continue...";
//getch();
}
float calculate (char product, int quantity, float price)
{
//char prod;
//int quant;
float total;
cout << "Product: " << product;
cout << "Quantity: " << quantity;
cout << "Price: " << price;
total = price * quantity;
return total;
}