|
-
July 28th, 2010, 02:06 PM
#14
Re: Simple GradeSystem
 Originally Posted by VladimirF
Consider this:
Code:
char findLetter(int grade)
{
static char LetterGrade[] = "F...FD...DC...CB...BA...A";
return LetterGrade[grade];
}
The ellipsis, of course, must be replaced with appropriate number of F’s, D’s, etc.
Good idea. You could further improve it by, instead of requiring one to manually count letters when creating the char array, instead populating a vector<char> using Boost.Assign's repeat() function.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|