Cannot produce output with this function

Everytime i run it...the value is always zero...can someone help me?edit the code

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
 #include <stdio.h>
float countfee(int);

int main()

{

int totalkid,confirm,x;
	float countfee1,countfee2,package;
	
	{
		printf("How many kids do you want to register? ");
		scanf("%d",&totalkid);
		
		printf("\n");
		
		for (x=1; x<=totalkid;x++)
		{
			printf("Please choose your package for kid number %d:",x);
			scanf("%s",&confirm);
			
			switch(confirm)
			{
				case '1' : if(package=170.00);
				break;
				case '2' : if(package=320.00);
				break;
				case '3' : if(package=440.00);
				break;
			}
		}
			{
			
				printf("\n\n** Your total monthly fee: RM%.2f **\n\n",countfee);
		printf("Thank You.\n\n");
			}
			
		
	}
			float countfee(totalkid);
			{
			float fee;
			
			
			countfee1=countfee1+package;
		
			
				countfee=countfee1*0.9;
	
				return countfee;
			
	}
}
		
			
	
1
2
        int totalkid,confirm,x;
        scanf("%s",&confirm);


%s let's scanf know that it is dealing with a C style string. confirm is not a C style string and this code results in undefined behavior.

Lines 40-52 make no sense. What are you trying to do there?
i try to use function operation...the body from 11-39 is for input and output...line from 40-52 for the calculation...so i basically want to make the calculation result show in line 34 which is the output
Last edited on
Topic archived. No new replies allowed.