C++ examples for Statement:if
#include <iostream> int qualityPoint(int); int main(int argc, const char *argv[]) { int average = 0; std::cout << "Input student average: "; std::cin >> average;/*ww w. j a v a 2 s.co m*/ std::cout << "Quality Point: " << qualityPoint(average) << std::endl; return 0; } // returns int representation of a students average int qualityPoint(int average) { if (average >= 90 && average <= 100) return 4; if (average >= 80 && average <= 89) return 3; if (average >= 70 && average <= 79) return 2; if (average >= 60 && average <= 69) return 1; return 0; }