Cout enter a score double score cin score cout the

This preview shows page 3 - 7 out of 11 pages.

cout << "Enter a score: "; double score; cin >> score; cout << "The grade is "; printGrade(score); return 0; } E. void 6.13 You should fill in the blank in the following code with ______________. #include <iostream> using namespace std; ________ getGrade(double score) { if (score >= 90.0) return 'A'; else if (score >= 80.0) return 'B';
else if (score >= 70.0) return 'C'; else if (score >= 60.0) return 'D'; else return 'F'; } int main() { cout << "Enter a score: "; double score; cin >> score; cout << "The grade is "; cout << getGrade(score) << endl; return 0; } D. char 6.14 Consider the following incomplete code: #include <iostream> using namespace std; int f(int number) { // Misssing function body } int main() { cout << f(5) << endl; return 0; } The missing function body should be ________.
6.15 When you invoke a function with a parameter, the value of the argument is passed to the parameter. This is referred to as _________.
6.16 The following code displays ______________. #include <iostream> using namespace std; void maxValue(int value1, int value2, int max) { if (value1 > value2) max = value1; else max = value2; } int main() { int max = 0; maxValue(1, 2, max); cout << "max is " << max << endl; return 0; } A. max is 0 6.17 Analyze the following code: #include <iostream> using namespace std; int xfunction(int n, long t) { cout << "int"; return n; } long xfunction(long n) { cout << "long"; return n; } int main() { cout << xfunction(5); return 0; }

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture