IHYPRESS.NET > "C"
> 04. Loops
A simple count from 1 to 100
A program that displays the numbers between 1 and 100.
Mission to the Moon
This program computes the length of a mission to take photographs around the Moon given the time it takes to get there and to go around the Moon once.
The fuel tank program
A program that monitors the amount of fuel in a tank and gives a warning if the supply falls below 10% of the tank's capacity.
Simple countdown using a
A program that displays all the numbers between 60 and 0 and then prints the word LIFTOFF afterwards.
Sums and averages
A program that computes the average of all the numbers in a file of integers.
Birdwatching program (fixed loop / file input)
This program reads a file that contains 12 lines of bird sightings and adds up all the sightings for a year.
Birdwatching program (EOF loop / feof)
A program similar to the previous one but with an unknown number of records in the file.
Birdwatching program (EOF loop / status var)
The same program that works with an unknown number of records but uses a status variable instead of the foef statement.
Birdwatching program (EOF loop / no status var)
The same program that works with an unknown number of records but does not use a status variable nor an foef statement.
Input validation loop (do-while)
The best use of a do-while loop: An input validation loop. This program validates that the color entered is a valid traffic light color.
COPYRIGHT © 2017 IHYPRESS.NET. A DIVISION OF IHY PRESS, KIRKLAND, WA 98083 USA. ALL RIGHTS RESERVED.