Exercises


  • What does the #include <iostream.h> do?
  • What is the difference between #include <iostream.h> and #include "iostream.h"?
  • Create a for loop that prints out the numbers 1 through 100.
  • Add an if statement to the above program that prints out "I like Nachos" instead of any number greater than 80.
  • Create a while loop that multiples the number 6.2 by itself until it is learger than a million. Have the program print out the number of times it had to loop.
  • Rewrite the above program, declaring 6.2 and 1 million as constants.
  • Write a program to print out all the odd numbers from 1 to 100. Hint: for loops usually jump ahead 1 integer...
  • Money conversion Mexican Peso to US Dollar Current exchange rates are about $.133 to 1 Peso or 7.48 Pesos per $1.00 A microwave burrito costs $.69 at the grocery store, write a program to tell the cost in pesos.
  • Write a program (Not in CERD!) to read in a number from the keyboard, and then display every number between 1 and that number.


Table of Contents

Hello, World! | The Pre-Processor | Headers | cout: The Black Box
More Wonders of cout | cin: cout's evil twin | Exercises