{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# FunFun - cout<<"The grade for"<<...

This preview shows page 1. Sign up to view the full content.

#include <iostream> using namespace std ; int square (int x) { return x * x ; } double totalCost (int quantity, double unitPrice) { const double TAXRATE = 0.005 ; double subTotal ; subTotal = quantity * unitPrice ; return subTotal + subTotal * TAXRATE ; } char computeGrade (int score, int cutoffA, int cutoffB, int cutoffC, int cutoffD ) { if (score >= cutoffA) return 'A' ; else if (score >= cutoffB) return 'B' ; else if (score >= cutoffC) return 'C' ; else if (score >= cutoffD) return 'D' ; else return 'F' ; } void printGrade (int score) {
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cout << "The grade for " << score << " is " << computeGrade (88, 90,80,70,60) << endl ; } int main() { int squared ; squared = square(x) ; cout << x << " squared is " << squared << "." << endl ; int q = 3 ; double p = 3.45 ; cout << "The price of square of " << q << " items is " << totalCost (q, p) << "." << endl ; cout << endl << endl ; cout << "The grade for " << 88 << " is " << computeGrade (88, 90,80,70,60) << endl ; printGrade (77) ; return 0; }...
View Full Document

{[ snackBarMessage ]}