Write the definition of a function printGrade , which has a char parameter and returns nothing. The function prints on a line by itself the message string Grade: followed by the char parameter (printed as a character ) to standard output . Don't forget to put a new line character at the end of your line.

Thus, if the value of the parameter is 'A', the function prints out Grade: A

this is what i have so far:

void printGrade(char){
cout << "Grade: " << endl;
}

I need to put something after Grade but I don't know what, please help. thanks

Recommended Answers

All 4 Replies

your passing char, now which char is that????? , that could be a huge hint! See if you can get this one yourself, i've done the rest, so I'm sure you can work this one out from the others?

shock1, any book on C++ will answer these questions for you. Please don't spam the board before searching for your own answers.

shock1, any book on C++ will answer these questions for you. Please don't spam the board before searching for your own answers.

void printGrade(char Grade)
{
printf("",Grade);
}
i have this one for codelab..same q but i need to put something between "" but i dont know wat am stcuk

>same q but i need to put something between ""
That's not the same question, it's the exact opposite. You already know what object to print, but you need the format string. The original question needed an object to print.

>but i dont know wat am stcuk
Unsurprisingly, my answer is the same to you as it was for the OP. The documentation on printf will tell you how to construct the format string for printing a single character. It's quite trivial, and you need to learn how to do simple research, so I won't give you the answer. Try googling for "printf format specifiers".

p.s. This isn't a chat room. You can take the time to write well here. You can even preview your post for proofing before posting it. There's absolutely no excuse for such horrid writing. Programmers should be more attentive than that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.