# Lab07_sample - CMPSC 101 Introduction to Algorithmic...

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

CMPSC 101 Introduction to Algorithmic Processes Summer 2007 LAB 7 – Function Calls 1. Write a program that computes the following mathematical expressions using C ++ predefined functions. A. 2 . 18 7 . 3 + B. 4 . 11 5 2 * 7 . 21 + C. ( 29 4 3 . 7 3 - // File name: Lab07_01.cpp // Description: C++ Predefined Functions // Lab 07-1 // Author: Jaehyun Lim // Date: Thursday, July 18, 2007 #include <iostream> #include <cmath> #include <cstdlib> using namespace std; int main() { double A, B, C; A = sqrt(3.7 + 18.2); B = pow(5, sqrt(21.7*2)) + 11.4; C = pow(fabs(3-7.3), 4); cout << A << endl << B << endl << C << endl; return 0;

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

View Full Document
} 2. Using a predefined function in C ++ , write a program that reads in two arguments ( base and exponent ) of type double and displays the value of the base raised to the power exponent . // File name: Lab07_02.cpp // Description: C++ Predefined Functions // Lab 07-2 // Author: Jaehyun Lim // Date: Thursday, July 18, 2007 #include <iostream> #include <cmath> using namespace std; int main() { double base, exponent; cout << "Enter a number for base: " ; cin >> base;
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 Pennsylvania State University, University Park.

### Page1 / 6

Lab07_sample - CMPSC 101 Introduction to Algorithmic...

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

View Full Document
Ask a homework question - tutors are online