I want my program to give a similar output like this if total > 0:
Welcome to the CIS 15AG Pizza Shack
Pizza slice - $2.50 [y/n]? y
Salad - $1.50 [y/n]? N
Drink - $1.00 [y/n]? y
Your total purchase: $3.50
Tax: $0.32
Total sale: $3.82
Enter your payment: 5
Thank you. Your change is $1.18
Enjoy your meal
else Welcome to the CIS 15AG Pizza Shack
Pizza slice - $2.50 [y/n]? a
You didn't answer y or n, assuming n
Salad - $1.50 [y/n]? B
You didn't answer y or n, assuming n
Drink - $1.00 [y/n]? 7
You didn't answer y or n, assuming n
Guess you're not hungry
This is the error message:
"error C2660: 'change' : function does not take 1 arguments"
change (total); <- underlined red in microsoft visual studio c++ 2010
Code:
#include <stdio.h>
void menu1 (float *cost1);
void change (float total, float pay, float chge);
int main(void)
{
float total;
printf ("hello to food store\n");
menu1 (&total);
change (total);
}
void menu1 (float *cost1)
{
char y;
float c1 = 0;
float tax;
float total;
char input;
printf ( "Would you like to order a sandwhich ($2.00) ? [y/n]");
scanf_s (" %c", &y);
if (y == 'y' || y == 'Y')
{
c1 = c1 + 2;
}
else if ( y != 'n' || y != 'N')
{
printf (" you didn't order, ill take that as a no\n");
}
printf ( "Would you like to order a salad also ($1.00) ? [y/n]");
scanf_s (" %c", &y);
if (y == 'y' || y == 'Y')
{
c1 = c1 + 1;
}
else if ( y != 'n' || y != 'N')
{
printf (" you didn't order, ill take that as a no\n");
}
printf ( "Would you like to order a drink to go with that ($1.00) ? [y/n]");
scanf_s (" %c", &y);
if (y == 'y' || y == 'Y')
{
c1 = c1 + 1;
}
else if ( y != 'n' || y != 'N')
{
printf (" you didn't order, ill take that as a no\n");
}
tax = c1 * .0925;
total = tax + c1;
printf ("Your total purchase comes out to be: %.2f\n", c1);
printf ("tax: %.2f\n", tax);
printf ("Total sale: %.2f\n", total);
*cost1 = total;
}
void change (float total, float pay, float chge)
{
if ( total > 0 )
{
printf ("Please enter your payment:");
scanf_s ("%f", &pay);
printf ("\n");
chge = total - pay;
printf (" You change is: %2.f", chge);
}
else
{
printf ("Please order something or leave");
}
}