#include <stdio.h>
#include <conio.h>
int HM=67.50, MS=87.00, Ms=92.75 ,a,b,c;
float oHM, oMS, oMs, T;
void main()
{
clrscr;
oHM=HM*a;
oMS=MS*b;
oMs=Ms*c;
T= oHM+oMS+oMs;

printf("Hi! May I take your Order?");;
printf("Here's our Menu");
printf("Happy Meal for 67.50, McSavers1 for 87.00, McSavers2 for 92.75");
printf("How many Happy Meal do you want?");
scanf("%d, &a");
printf("It would be for %f,oHM");
printf("How manyMcSavers1 do you want?");
scanf("%d, &b");
printf("It would be for %f,oMS");
printf("How many McSavers2 do you want?");
scanf("%d, &c");
printf("It would be for %f,oMs");
printf("Your total bill is %f,T");
printf("Thank You. Come Again");

getch()
}


HELp plss

Recommended Answers

All 2 Replies

guys help why the value of oHM=HM*a;oMS=MS*b; oMs=Ms*c; is 0.000 can you help me how to get the correct output tnks


guys im newbie and i dont have any idea for know aout programing

a, b and c do not have a value assigned to them and you are using them.

I think this is how you want the program structured.

Compare what I have to what you have closely because you made many errors and I didn't comment all of them in.

#include <cstdio> //dont use name.h headers use cname headers
#include <conio.h>

float HM = 67.50, MS = 87.00, Ms = 92.75, a, b, c; //change data type to float or double ints do not have decimals
float oHM, oMS, oMs, T;
int main() //always use int main() not void main()
{
	printf("Hi! May I take your Order?");;
	printf("Here's our Menu");
	printf("Happy Meal for 67.50, McSavers1 for 87.00, McSavers2 for 92.75\n");
	printf("How many Happy Meal do you want?\n");
	scanf("%f", &a);
	oHM = HM * a; //figure out oHM after you get a value for a
	printf("It would be for %f\n", oHM);
	printf("How manyMcSavers1 do you want?\n");
	scanf("%f", &b);
	oMS = MS * b; //figure out oMS after you get a value for b
	printf("It would be for %f\n", oMS);
	printf("How many McSavers2 do you want?\n");
	scanf("%f", &c);
	oMs = Ms * c; //figure out oMs after you get a value for c
	printf("It would be for %f\n", oMs);
	T = oHM + oMS + oMs; //total everything up once you get values for oHM oMS and oMs
	printf("Your total bill is %f\n", T);
	printf("Thank You. Come Again\n");

	getch();
	return 0; //add a return since it is int not void
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.