Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Pass char to function

$
0
0
Hi I'm new to programming and was trying to pass a value to a function that has a switch case in it but I can't seem to get any value in. It goes straight to the default switch statement.
void GetRangeCase(char &LetterGrade)
{
	char caseVal;
	caseVal = LetterGrade;

	switch (caseVal) {
	case 'A': 
		cout << "Your grade is: 90 and above";
		break;
	case 'B':
		cout << "Your grade is between: 80 and 89";
		break;
	case 'C':
		cout << "Your grade is between: 70 and 79";
		break;
	case 'D':
		cout << "Your grade is less than: 70";
		break;
	default:
		cout << "Incorrect value";
	}
	cout << endl << endl;
	cout << "Press Enter to Continue."; cin.get(); cin.get();
}

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>