Eeo 224 object-oriented programming for electrical and


Exercise Set

Variables, Data Types and Functions

1. Install the Integrated Development Environment on your computer. This will be Microsoft Visual Studio for the PC and Xcode for MAC users.

2. Write, compile and run your first C++ program. This program outputs Hello World to the screen. Please refer to the instructions on Creating, Compiling and Running your First C++ Program provided in Module 1.

3. Write a function called AddDouble(...) which adds two numbers of type double and returns the result.

4. Write a recursive function called fibonacci(...), which would compute the first 21 Fibonacci numbers F0, F1,... F20, and print it to the screen. The first two Fibonacci numbers are F0 = 0, F1 = 1, and thereafter each successive Fibonacci number Fi is the sum of the two preceding Fibonacci numbers Fi-1 and Fi-2.

5. Write a simple program to declare and initialize variables, and print the following quantities:
- The number of people currently taking EEO 224 (there are 9 students).
- The number of atoms in the "known universe"(≈ 1082).
- The population of USA (≈ 325,467,306).
- The population of Earth (≈ 7, 598,406,385).
- Two variables: First initials of your first name and last name.

6. Write a program which opens a file and reads several numbers, utilizing the fscanf() function.

Solution Preview :

Prepared by a verified Expert
Programming Languages: Eeo 224 object-oriented programming for electrical and
Reference No:- TGS02659425

Now Priced at $40 (50% Discount)

Recommended (93%)

Rated (4.5/5)