Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

C Programming: iOS Development Starts Here!

Lab Exercise 4 1. Load XCode and start a new C project. If you wish, remove any extraneous code from the project so that you are left with only whats necessary to run the main function in your project. 2. Create an integer array called ages with the following values: 12, 15, 19, 27, 5, 6. Make sure you create an array with the correct number of indexes. 3. Loop through the array outputting each value to the console. 4. Create an additional array of floating point values called prices. Populate this array with the following values: 9.99, 7.85, 15.99, 17.25, 12.00, and 16.75. Imagine that this array contains prices from an order at a retail store. 5. Create one more array called taxable of the type char. Initialize the array with the following values: T,T,T,F,F,T. The values in this array represent whether each item in the parallel index in the prices array is taxable. 6. Create a loop that will take you through both arrays. For each index determine the value of the taxable array. If the value of the taxable array is T, then, tax that price at a rate of .065% and output the new value with tax. If the index is non-taxable, simply output the untaxed value from the prices array. 7. At the end of the loop output the total of the order. Hint: You will need to create a new floating point variable for this. 8. Test and debug as necessary. Refine your work so all floating point values are output in the following format: $XX.XX. 9. Create a new application and create four character arrays to hold the following lines of text: Roses are Red Violets Are Blue C Programming is Fun

And Sometimes Makes my Head Hurt Make sure your character arrays are large enough to accommodate the character used to terminate C strings. Using a correctly formatted printf() command and signifier, output the string array values.

Remember: Register as a LearnToProgram.tv student at www.learntoprogran.tv/register. This will provide you access to numerous resources as well as discounts on future classes. Help is available! Utilize the forms that are available to you as well as the instructor. Lab exercises are checked upon request

You might also like