Homework 9

Due: 4/6/04

Task: Write a program that reads in base-power pairs from a file into two arrays, one that stores all the bases and one that stores all the powers. Use a third array to store the result of raising each base to its corresponding power. Print out to the screen these results. The input file will be in the format:

5	6
3	4
10	3
13	5
2	3
Etc. The input file will be one I create that can contain any set of integers. In other words, it won't look like the example above.

The output should look like this when your program is done:

5 to the 6th power is 15625
3 to the 4th power is 243
10 to the 3th power is 1000
13 to the 5th power is 371293
2 to the 3th power is 8

The output should contain one line for every pair of numbers in the input file.

NOTE: Use the #define precompiler directive to set a MAX for the size of your arrays. Start with a MAX of 10.


Purpose: To learn and practice how to use arrays in a program.