+ 1

Help!: Tryin to get the input of a number to return back a letter grade

#include <stdio.h> using namespace std::cout using namespace std::cin int studentGrade = 100; int letterGrade(){ if(studentGrade > 90); cout << 'A'; } int main() { cout << "Please enter grade:"; cin >> studentGrade >> endl; return 0; }

14th Jun 2018, 3:27 AM
RaVon
RaVon - avatar
4 Respostas
0
Yes BOOKA012 Rhone , the top is fine. It might be easier just to use this though: #include <stdio.h> using namespace std;
14th Jun 2018, 3:27 PM
Zeke Williams
Zeke Williams - avatar
+ 1
I think you have return and output mixed up; the function letterGrade() does not need to return an int, if you are using cout. Try this instead: void letterGrade(int grade) { if (grade > 90) { cout << "A" << endl; } } int main() { int grade; cout << "Please enter grade: "; cin >> grade; letterGrade(grade); }
14th Jun 2018, 4:42 AM
Zeke Williams
Zeke Williams - avatar
+ 1
oh wow, i realky did have it mixed up there! Thanks👌🏽
14th Jun 2018, 4:49 AM
RaVon
RaVon - avatar
0
also is my top portion correct if im trying to write in c programming. i get it mixed up with c++
14th Jun 2018, 4:54 AM
RaVon
RaVon - avatar