Learn How to Program in C

by
Dr. Kristin Switala

Introduction

Directives

Variables

Conditionals

Loops

Arrays

Pointers

Strings

Functions

Structures


Site Map

Projects: Arrays (a)

Instructions: Create a C program that runs successfully for each project below.


Project 1

Create a program that provides a timeline for the decline of the Ottoman Empire. Here are the dates:

  • 1699 lost Hungary
  • 1878 lost southern Europe
  • 1882 lost Egypt
  • 1913 lost North Africa
  • 1920 lost the Middle East

Use an array to store these dates. Then calculate the total length of time that it took for the Ottoman Empire to decline (from 1699 - 1920).


Project 2

Create a program that stores population figures for the year 2000 in an array. Then use the array elements to print this table:

Central Asian Populations in 2000
Tajikistan
6440732
Kazakhstan
16733227
Uzbekistan
24755519

Project 3

Many countries gained independence in the 1900s, including Australia (1901), Nigeria (1960) and Namibia (1990). Put these years into an array. Ask the viewer "What year is it today?" and store the answer. Then use the current year to calculate how long each country has been independent. Print a sentence about each country's length of independence.


Project 4

Here are some driving times between cities in Florida:

Miami to Daytona Beach is 5.5 hours
Ft. Lauderdale to Daytona Beach is 5.0 hours
Sarasota to Daytona Beach is 4.0 hours
Ft. Myers to Daytona Beach is 4.3 hours

Put these driving times into an array, then calculate the average driving time to Daytona Beach from within Florida. Print the answer on the screen.

Copyright
© 2001
Kristin Switala
Hosted by www.Geocities.ws

1