1. ## While Loop

#include <stdio.h>

int main()

{

char A, B, C, D, E;
char AllCredit, CreditAttempt;
float GPA, GpaCalc;

char Grades = 'A', 'B', 'C', 'D', 'E';
int Points = '4','3','2','1','0';

A = 4;
B = 3;
C = 2;
D = 1;
E = 0;

AllCredit = GPA / CreditAttempt;

while (Grades = getchar() != "\n")
{
}
}
return 0;

}

Here is my code. I want to find out if I there is a way I could use a loop to get ABCDE and 01234 in the loop so that it prints out
something like A4C2B3B3. I know I have a problem with Grades and Points up there, I am right now trying to find out how I could use make it so that when the letter A is pressed I get a 4 to come up and or manually enter numbers so that the program can recognize the all the numbers and print out GPA is 3.24 or 4.00.

Thank You Very much in advance. 2. Ok, a few bits to get you started

This should allow you to type 'A' and get '4' printed - and extending the idea is pretty easy...

Code:
```int main ( ) {
while ( (grades=getchar()) != '\n' ) {  // note the extra ()
if ( grades == 'A' ) putchar( '4' );
}
}```
> char Grades = 'A', 'B', 'C', 'D', 'E';
> int Points = '4','3','2','1','0';
If you need to do something like this, you should be looking at arrays. For instance, what you have written will only assign 'A' to Grades, the rest of the letters are thrown away. 3. ## I think you need to study a lot more....

To do what you want to do is nothing but forces you to study a lot about Arrays, characters, Set of characters (String), declaration of variables, differences between integer and character..... Popular pages Recent additions 