Switch and For Statements, Command Line and File Handling - Exercises
Chapter chap9 section 9
Write a program that will evaluate a simple arithmetic expression read from the command line. I.e. the user will type
myprog 3+4
and the program will respond with 7.
Write a version of the file copying program that prompts the user for the source and destination file names.
Write a version of the file copying program that takes the source and destination file names from the command line. Devise suitable tests to detect the incorrect number of command line arguments and invalid file names. Modify your program to determine whether the destination file already exists and generate a suitable warning if it does.
Write a program using nested for loops to print out a multiplication table. See
earlier notes
for an example of this done using the while statement.