Hello, I'm working on an assignment to create a program that takes in 4 test grades and returns a letter grade. The first two grades are 0-10, the second two are 0-100. When I enter the command "./exercise3 10 10 100 100", it returns an A, just as it should. But when I try different grades, like "./exercise3 8 8 85 85", it returns an A as well. I know my math is correct because the program works fine with normal console input, so something is wrong in how I've written my input function involving command line arguments. It's probably something stupid but I'm out of ideas at this point. Thanks in advance!
newScores.quiz1 = input1[1]; What are you doing here (and on following lines)? How that was supposed to work?
You are assigning second character in input1 to quiz1. If input1 is 10 then it will be int('0') → 47. quiz2 and others gets some junk from buffer which can be anything from 0 to 255 (or -128 to 127 depending on your compiler).
Try to print scores data before calculating grade and you will see that.
I see... I know it looked funny but I couldn't get anything else to compile. That makes sense though. How would I go about passing in the entire character array?