Almost there!

Why is my code only reaching the If statements if (A, B, or C) is capitalized?
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
#include <iostream>
#include <iomanip>
using namespace std;

//function prototypes
void displayStandard(double totalBalance);
void displayPlus(double totalBalance);
void displayPremium(double totalBalance);

int main()
{
	char membership = ' ';
	double balance = 0.0;
	double points = 0.0;

	
	
	cout << "(A) Standard " << endl;
	cout << "(B) Plus " << endl;
	cout << "(C) Premium " << endl;
	cout << "Enter membership type (A, B, C):  ";
	cin >> membership;

	while (toupper(membership) != 'A' && toupper(membership) != 'B' && toupper(membership) != 'C')
	{
		cout << "Please enter A, B, or C: " << endl;
		cin >> membership;
	}
		

	cout << "Please enter your total monthly purchase: ";
	cin >> balance;
		
		if (membership == 'A')
		
			displayStandard(balance);
		
		else if (membership == 'B')
		
			displayPlus(balance);
		
		else if (membership == 'C')
		
			displayPremium(balance);
		
	

	system("pause");
	return 0;
}//end of main

//*****function definitions*****


void displayStandard(double totalBalance)
{
	double rewards = 0.0;
	
	if (totalBalance < 75)
		rewards = .05 * totalBalance;
	
	else if (totalBalance >= 75 && totalBalance <= 149.99)
		rewards = .075 * totalBalance;

	else (totalBalance >= 150);
	rewards = .10 * totalBalance; 

	cout << fixed << setprecision(0);
	cout << "STANDARD " << endl;
	cout << "--------"<< endl;
	cout << "You have earned " <<rewards << " reward points!" << endl << endl;
}//end of standard function

void displayPlus(double totalBalance)
{
	double rewards = 0.0;
	
	if (totalBalance < 150)
		rewards = .06 * totalBalance;
	else
		rewards = .13 * totalBalance;

	cout << fixed << setprecision(0);
	cout << "PLUS" << endl;
	cout << "----" << endl;
	cout << "You have earned " <<rewards << " reward points!" << endl << endl;
}//end of plus function

void displayPremium(double totalBalance)
{
	double rewards = 0.0;
	
	if (totalBalance < 200)
		rewards = .04 * totalBalance;
	else
		rewards = .15 * totalBalance;

	cout << fixed << setprecision(0);
	cout << "PREMIUM" << endl;
	cout << "-------" << endl;
	cout << "You have earned " << rewards << " reward points!" << endl << endl;
}//end of premium function 
What do you exactly need to do? Can you write the assingement/task/problem here?
toupper(membership) doesn't change the value of membership, so if membership is lowercase, then doing a check like this membership == 'A' would miss a lowercase 'a'.
I found the problem. Thanks for responding though...

 
membership = (toupper(membership))
Topic archived. No new replies allowed.