Programming Exercises

   


1:

Create a text file with Notepad called C:\MyTestFiles\ShortStory.txt with the contents:

 This text Only contains Three lines 

Write a program that tells the user the full name of the file and when it was created.

Please keep this program handy for exercise 2.

2:

Extend the program in exercise 1 so that the program also counts the number of lines in C:\MyTestFiles\ShortStory.txt and shows this number on the console.

3:

Write a program that contains an array called rainfall, containing twelve elements of type byte. Each element represents a monthly rainfall reading and can have a value between 0 and 200. Include a simple user interface so that the user can view the element values of rainfall and assign values to any one of its elements.

Expand the user menu so that the user can choose to save the contents of rainfall to a file called C:\MyTestFiles\Rainfall.dat. Furthermore, include an option in the user menu that allows the user to load the data contained in C:\MyTestFiles\Rainfall.dat back into the rainfall array. This must permit the user to save the rainfall data kept in the rainfall array, end the program, and later restart the program and load the Rainfall.dat data back into the rainfall array of the program.


   


C# Primer Plus
C Primer Plus (5th Edition)
ISBN: 0672326965
EAN: 2147483647
Year: 2000
Pages: 286
Authors: Stephen Prata

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net