So the user enters a character like c+ or b- and then I pass that input into another function which figures what he entered. I'm using strcpy and passing by reference but I keep on getting these weird errors.
1 2 3 4 5 6 7 8 9 10 11 12
[ansm@pc7.cs.ucdavis.edu GPACalculator]$ g++ -Wall gpa.cpp gpa.h main.cpp
gpa.cpp: In member function 'void gpa::getInput()':
gpa.cpp:14:20: error: no matching function for call to 'gpa::processInput(char (*)[3])'
gpa.cpp:14:20: note: candidate is:
gpa.h:12:7: note: void gpa::processInput(char*)
gpa.h:12:7: note: no known conversion for argument 1 from 'char (*)[3]' to 'char*'
gpa.cpp: In member function 'void gpa::processInput(char*)':
gpa.cpp:20:6: warning: unused variable 'three' [-Wunused-variable]
gpa.cpp:21:6: warning: unused variable 'threem' [-Wunused-variable]
gpa.cpp:22:6: warning: unused variable 'twop' [-Wunused-variable]
gpa.cpp:23:6: warning: unused variable 'two' [-Wunused-variable]
gpa.cpp:24:6: warning: unused variable 'twom' [-Wunused-variable]
Help please? thanks guys! I really enjoy the community around here they've helped me so much already. Trying to learn c++ this summer before I actually need it in College haha :)
When passing an array into a function it gets passed by the address of the array automatically, meaning you don't need the & before it. In this case change processInput(&input); to processInput(input);
Also on a side note I wouldn't call a class and a variable the same thing (you have a gpa class and a gpa float) as, at least in my compilers case (Visual Studio), it gets confused.
Everything else you have are just warnings as you haven't used those variables yet.