Lecture 23: Arrays 2
Thursday, November 17, 2011 Status: complete[Up] [Previous Lecture] [Next Lecture]
Powerpoint Slides: none
Reading Assigned: 8.4-8.5
Homework Due:
Homework Assigned:
Topics Covered:
- Interfacing with spreadsheet programs (e.g., Microsoft Excel, OpenOffice Calc).
- Finish Classwork 22
Programs Shown:
- We looked at a program
bonus.c that
uses scanf() to read in columns of data separated by
tabs. Such data might be exported from a spreadsheet program
as tab-delimited text. (Example:
Auto_Sales.txt
was exported from
Auto_Sales.xls.)
In our runs, we used input redirection to provide the data in Auto_Sales.txt to our program. The output can also be saved in a file Bonus.txt using output redirection. (See sample run.)
The output file can be imported into spreadsheet applications like Microsoft Excel and OpenOffice Calc. Depending on the particular version of your application, you may need to use a .csv or .txt file extension.
Finally, note that bonus.c was compiled along with primes.c and needs the header file primes.h, which implement the isprime() and findprime() functions from Homework 10.