Lab Assignment 3

Lab Assignment 3 - Program 3: Same as Program 2, except...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Lab Assignment 3 Objectives: Become familiar with increment/decrement operators Become familiar with if…else statements Become familiar with switch…case statements Program 1: Write a program which illustrates that after executing c = a++ + ++b; (c == a + b) is false. A cout statement within an if…else statement can be used to print out “ true ” or false Program 2: Write a program which can be used to determine a grade using nested if… else control structures. The user inputs two numeric grades, semester grade (excluding final), and final exam grade. Based on an 80/20 weighting, an average numeric grade is calculated and output. Then a letter grade is assigned can do this by outputting before and after values, including conclusions. An if…else based on grade criteria, e.g., 90-100 A. The output should go to the monitor and should include average grade and letter grade.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Program 3: Same as Program 2, except that a switchcase statement is used to select and output the appropriate letter grade for each student based on the work performed, instead of nested ifelse statements as in part B. Suggestion: your switch variable can be 1/10 of your grade, thus, a case statement might look like this: case 8: cout << B; break; The default: statement of the switch can be used to allocate Fs. Lab Assignment 3 Examples Program 1. Please enter integers a and b: 22 7 After executing c = a++ + ++b; a = 23; b = 8; and c = 30. c == a + b is false. Programs 2 and 3 (code is different, output is same). Please enter students semester and final exam grades: 95 76 Students numeric and letter grades are 91.2 and A....
View Full Document

This note was uploaded on 06/28/2011 for the course CS 171 taught by Professor Ravi during the Spring '11 term at Minnesota.

Page1 / 2

Lab Assignment 3 - Program 3: Same as Program 2, except...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online