Need help with assigning user input

I know this is a very basic question but it is driving me crazy right now. I Am writing a program to determine the pay of an A, B, or C level author. The user would input the letter of the level and the number of words for the story. The Pay is calculated from there.
**How do I assign the users input to different variables? It shouldn't matter if the letter is capitalized or not. Would I just use a simple if statement?

The code is just an example what I thought assigning the input would look like... skillLvl is the users input
1
2
3
4
5
6
7
8
9
void lvlDetermination(float skillLvl) {
	if (skillLvl == A || a)
		skillLvl = lvlC;
	else if (skillLvl == B || b)
		skillLvl = lvlB;
	else if (skillLvl == C || c)
		skillLvl = lvlC;
	else
		cout << "Please enter the Correct Skill Level Between A and C " << endl;
if (skillLvl == A || a)

That thing on the right. It's NOT "skillLvl is the same as a". It's just "a". I expect you meant:

if (skillLvl == A || skillLvl == a)

Anyway, I think you're maybe asking for something like this:

1
2
3
4
char skillLvl ;
cin >> skillLvl ;  // ONE character only

if (skillLvl == 'a' || skillLvl == 'A')


Once you get it working, look into http://www.cplusplus.com/reference/cctype/tolower/

Last edited on
OK, I believe I understand what you are are saying. .. So what about the other two Character values? (B, C) Do I have to declare a different variable for each of them or can all input be through "char skillLvl"? Only one will be in use at a time since One character is considered the Authors skill level. So the only time there will be an additional Character is when the program is run again.
Topic archived. No new replies allowed.