How could I substitute a value in c++

Hi,This is my final project of my first semester.
and i got a question when to substitute a value-discount of the item-in the program. It appears at the second switch loop, and I have 2 method but all donot work. The command is to replace the discount in the header file with a new one when you hit 'O' character. If you can supply any hint or help, I really appreciate it.

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
  THIS THE HEADER FILE.
// DEFINE SECTION
#define GST 0.05
#define PST 0.08
#define i1     "6GB PC6400 DDR2 800MHz Memory"
#define i1_p   87.97
#define di1_p  15.0
#define i2     "Quad Core Processor - 2.60GHz"
#define i2_p   109.42
#define di2_p  12.0
#define i3     "Cordless Desktop Keyb & Mouse"
#define i3_p   179.97
#define di3_p  8.5
#define i4     "Asus P6T LGA 1366 Motherboard"
#define i4_p   673.99
#define di4_p  5.5
#define i5     "28in  Widescreen  LCD Monitor"
#define i5_p   299.97
#define di5_p  9.5
#define i6     "Radeon HD 5770 Video Card 2GB"
#define i6_p   194.97
#define di6_p  33.3
#define i7     "Sound  Blaster  Xtreme  Audio"
#define i7_p   65.99
#define di7_p  4.5
#define i8     "Western Digital  1TB  My Book"
#define i8_p   189.97 


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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
#include <stdlib.h>      // Define 4 printf,scanf,getchar,puts,gets,fflush
#include <stdio.h>       // Define 4 system
#include <conio.h>       // Define 4 getch
#include <math.h>        // 
#include "PROJECT.h"

// FUNCTION PROTOTYPE
char menu(float numA, float numB, float numC, float numD, float numE, float numF, float numG, float numH, float numI, float numJ, float sub_tot, float tot_tot);
float getnumber(void);

int main(void)
{
	// CLEAN THE SYSTEM
	system("cls");

    // VARIABLE DECLARATION
    float num_Am=0, num_Bm=0, num_Cm=0, num_Dm=0, num_Em=0, num_Fm=0, num_Gm=0, num_Hm=0, num_Im=0, num_Jm=0;
	float sub_total;
	float tot_total;
	char choose;

	float T_A,T_B,T_C,T_D,T_E,T_F,T_G,T_H,T_I,T_J;
	char overRideItem;
	float newDisc;
	
	// DO LOOP
    do
	{
	// CALL MENU() FUNCTION
	choose = menu(num_Am, num_Bm, num_Cm, num_Dm, num_Em, num_Fm, num_Gm, num_Hm, num_Im, num_Jm, sub_total, tot_total);

        // SWITCH LOOP
	switch (choose)
	{
		case 'A':
		case 'a':
			num_Am = getnumber();
			break;
		case 'B':
		case 'b':
			num_Bm = getnumber();
			break;
		case 'C':
		case 'c':
			num_Cm = getnumber();
			break;
		case 'D':
		case 'd':
			num_Dm = getnumber();
			break;
		case 'E':
		case 'e':
			num_Em = getnumber();
			break;
		case 'F':
		case 'f':   
		        num_Fm = getnumber();
			break;
		case 'G':
		case 'g':
			num_Gm = getnumber();
			break;
		case 'H':
		case 'h':
	                num_Hm = getnumber();
			break;
		case 'I':
		case 'i':
			num_Im = getnumber();
			break;
		case 'J':
		case 'j':
			num_Jm = getnumber();
			break;
		case 'R':
		case 'r':
	num_Am=0, num_Bm=0, num_Cm=0, num_Dm=0, num_Em=0, num_Fm=0, num_Gm=0, num_Hm=0, num_Im=0, num_Jm=0;
			break;
		case 'O':
		case 'o':	
			printf("\nItem to OverRide==>");
			fflush(stdin);
			scanf("%c",&overRideItem);
			printf("\tNew Disc%%==>");
                        fflush(stdin);
			scanf("%f",&newDisc);
			switch(overRideItem)
			{
			case 'A':
			case 'a':
				T_A = i1_p*(1-newDisc/100);
				break;
			case 'B':
			case 'b':
				di2_p = newDisc;
				break;
			case 'C':
			case 'c':
				di3_p = newDisc;
				break;
			case 'D':
			case 'd':
				di4_p = newDisc;
				break;
			case 'E':
			case 'e':
				di5_p = newDisc;
				break;
			case 'F':
			case 'f':
				di6_p = newDisc;
				break;
			case 'G':
			case 'g':
				di7_p = newDisc;
				break;
			case 'H':
			case 'h':
				di8_p = newDisc;
				break;
			case 'I':
			case 'i':
				di9_p = newDisc;
				break;
			case 'J':
			case 'j':
				di10_p = newDisc;
				break;
			default:
			printf("\n\t You entered an incorrect character.\a")
			system("pause");
			}
			case '-A':num_Am--;break;
			case '-B':num_Bm--;break;
			case '-C':num_Cm--;break;
			case '-D':num_Dm--;break;
			case '-E':num_Em--;break;
			case '-F':num_Fm--;break;
			case '-G':num_Gm--;break;
			case '-H':num_Hm--;break;
			case '-I':num_Im--;break;
			case '-J':num_Jm--;break;				    
            case 'X':
	    case 'x':
	        printf("\n\t You will exit the program.\n");
		break;
	    default :
		printf("\n\t You entered an incorrect character.\a");

		system("pause");		
			}
	}while(choose!='X'&&choose!='x');
	
	
	getch();
	return 0;
}

char menu(float numA, float numB, float numC, float numD, float numE, float numF, float numG, float numH, float numI, float numJ, float sub_tot, float tot_tot)
{

	// VARIABLE DECLARATION
	char choice;
	float t_A,t_B,t_C,t_D,t_E,t_F,t_G,t_H,t_I,t_J;

	// PRINT OUT THE MENU
	printf("\n\t\t\tDave's Discount Computers\n");
	printf("\n\t\t COMPUTER PART\tPrice\tDisc %%\tNumber\tAmount\tTotal\n\n");
	printf("\n\t %s    \t %.2f \t %.2f \t$  %.2f",i1,i1_p,di1_p,numA,A_A,t_A);
	printf("\n\t %s    \t %.2f \t %.2f \t$  %.2f",i2,i2_p,di2_p,numB,A_B,t_B);
	printf("\n\t %s    \t %.2f \t %.2f \t$  %.2f",i3,i3_p,di3_p,numC,A_C,t_C);
	printf("\n\t %s    \t %.2f \t %.2f \t$  %.2f",i4,i4_p,di4_p,numD,A_D,t_D);
	printf("\n\t %s    \t %.2f \t %.2f \t$  %.2f",i5,i5_p,di5_p,numE,A_E,t_E);
	printf("\n\t %s    \t %.2f \t %.2f \t$  %.2f",i6,i6_p,di6_p,numF,A_F,t_F);
	printf("\n\t %s    \t %.2f \t %.2f \t$  %.2f",i7,i7_p,di7_p,numG,A_G,t_G);
	printf("\n\t %s    \t %.2f \t %.2f \t$  %.2f",i8,i8_p,di8_p,numH,A_H,t_H);
	printf("\n\t %s    \t %.2f \t %.2f \t$  %.2f",i9,i9_p,di9_p,numI,A_I,t_I);
	printf("\n\t %s    \t %.2f \t %.2f \t$  %.2f",i10,i10_p,di10_p,numJ,A_J,t_J);
	printf("\n");
	printf("\n\t\t SubTotal this order = $%.2f ",sub_tot);
	printf("\n\t\t\t\t PST  = $%.2f ",PST_T);
    printf("\n\t\t\t\t GST  = $%.2f ",GST_T);
    printf("\n\t\t TOTAL this order = $%.2f ",tot_tot);

    printf("\n\n\t SELECT (A-J), O-OverRide, R-Reset, -Correct, X-Exit ==>");

	printf("\n\n\t Input the CAPITAL==>");
	fflush(stdin);
	scanf("%c",&choice);

	return(choice);
}

float getnumber(void)
{
	// VARIABLE DECLARATION
	float number;

	// GET THE NUMBER FROM THE USER
    printf("\n\t Input the number==>");
	fflush(stdin);
	scanf("%f",&number);

	if(number>0)
		return(number);		
	else
		printf("\n\nInput a valid number.\a");

	return(0);
}
I know there are some other errors in the program, but I am trying to figure them out by myself but cannot think the substitute out , so ask for the help.
Topic archived. No new replies allowed.