for(int x=0; x<7; x++){
//stuff
elseif(x==7) //never get here
}
This is why you don't see any letters. Also, output should only contain 6 columns, but you do stuff for 7 columns (x=0, x=1, ..., x=6) and are exceeding the array bounds of output on line 15 when x is 6: cout<<output[i][x]; //remember index counting starts at zero
This is probably why you see some garbage displayed. There may also be inappropriate arrays being passed into the table() function which could also cause garbage to be displayed.
Also you may want to consider breaking up table() into smaller, more manageable functions you can modify and error-check one at a time.
This makes the problem worse since now you're going even more out of the bounds of the output array. The problem is that only output[i][0] to output[i][5] are valid (assuming they've been initialized). output[i][6] (and now output[i][7]) is garbage.
Also something else I've just noticed is that you're printing a newline before the letter grade, which isn't what you want to do. Once you've fixed the index problem you'll want to fix this too or else your output will look like this:
Also note that what is printed to the screen is not properly aligned, but I don't know if that's a result of your copying and pasting code or if that's what is really printed on the screen. If it's the latter you can format output to make everything fit nicely but it's not a big issue.
I'm not trying to put a new value into output. I'm trying to print ltrgrds after each line of output. Am I able to do this? If I can't, I know how to change it back but I need to find some way of making sure the letter gradses stay as letters. I have this whole problem because they are displayed as random letters there too, even when output is a char.
You end up changing memory outside the bounds of output as well as displaying memory values outside the range of output thanks to line 15 of your code. Here's what happens (using code initially given in post):
1)Enter outer for() loop on line 4, declare integer i and assign it value 0.
2)Enter inner for() loop on line 5, declare integer x and assign it value 0.
3)x == 0 so output[0][0] assigned value names[0][0]
4)print output[0][0]
5)print tab
6)increment x, so now x == 1
7) for each x == 1 to x == 4 the inner loop assigns output[0][x] the value grades[0][x-1] then prints the value followed by a tab, then increments x.
8) for x == 5 the inner loop assigns output[0][5] the value average[0][0] then prints the value followed by a tab, then increments x.
9) for x == 6 the inner loop assigns output[0][6] the value average[0][0] the prints output[0][6]. Note that the assignment is changing memory outside the bounds of output
and the behaviour of such an assignment is undefined (I think), the program could even crash. For your system the program prints garbage. The program then prints a newline, then increments x.
10) for x == 7 the inner loop terminates and the x variable is destroyed (ltrgrds[0][0] is never printed). The outer loop then increments i and 2) - 9) repeat (using the new i value) until i == 3.
I'm trying to print ltrgrds after each line of output. Am I able to do this?
Yes, but you need to change you code so that when x == 6 you don't print garbage, but rather the letter grade.