Lab03_sample

# Lab03_sample - CMPSC 101 Introduction to Algorithmic...

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

CMPSC 101 Introduction to Algorithmic Processes Summer 2007 LAB 3 – if-else Statement 1. [text p.83] Write an if-else statement that outputs the word Passed provided the value of the variable exam is greater than or equal to 60 and the value of the variable programs_done is greater than or equal to 10 . Otherwise, the if-else statement outputs the word Failed . The variable exam and program_done are both of type int . #include <iostream> using namespace std; int main() { int exam, programs_done; cout << "exam score? " ; cin >> exam; cout << "program score? " ; cin >> programs_done; if cout << "PASSED" << endl; else cout << "FAILED" << endl; return 0; } 2. The LeVan Car Rental company charges \$0.25/mile if the total mileage does not exceed 100. If the total mileage is over 100, the company charges \$0.25/mile for the first 100 miles, then it charges \$0.15/miles for any additional mileage over 100. Write a program

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 07/14/2008 for the course CMPSC 101 taught by Professor Drobish,renee during the Summer '07 term at Penn State.

### Page1 / 3

Lab03_sample - CMPSC 101 Introduction to Algorithmic...

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

View Full Document
Ask a homework question - tutors are online