The function promises that it will return a value of type double. If none is specified, that should give a warning message from the compiler, because it means there is a problem in the code. In this case it means some sort of garbage value is returned by default. Instead, you should add some code to specify what you would like the value to be. For example, put return 0.0; or whatever value suits your purpose .
Note also these messages from the compiler:
In function 'double gpa(char*, char*)':
23:11: warning: comparison with string literal results in unspecified behaviour [-Waddress]
25:12: warning: comparison with string literal results in unspecified behaviour [-Waddress]
30:1: warning: control reaches end of non-void function [-Wreturn-type]
This works even when you pass it a c-string (character array) because it automatically converts the input value to type string when the function is called.