+ 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; }
4 Respuestas
0
Yes BOOKA012 Rhone , the top is fine. It might be easier just to use this though:
#include <stdio.h>
using namespace std;
+ 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);
}
+ 1
oh wow, i realky did have it mixed up there! Thanks👌🏽
0
also is my top portion correct if im trying to write in c programming. i get it mixed up with c++