In-Class Practice

Arrays


Convert the following program into a program that uses a one-dimensional array

 // Price List - Variable Form
 // priceList.c

 #include <stdio.h>

 int main(void)
 {
         double price1 = 10.60, price2 = 23.45, price3 = 5.89; 

         displayList(price1, price2, price3);
         printf(" Item     Price\n");
         printf("    1%10.2lf\n", price1);
         printf("    2%10.2lf\n", price2);
         printf("    3%10.2lf\n", price3);
         printf("Total%10.2lf\n", price1 + price2 + price3);

         return 0;
 }




   Printer Friendly Version of this Page print this page     Top  Go Back to the Top of this Page



  Designed by Chris Szalwinski   Copying From This Site   

Creative Commons License