PROJECT_5 - cout<<<Literal Text> with or without...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 31: INTRODUCTION TO COMPUTER SCIENCE I Computer Science Department University of California, Los Angeles Dr. John A. Rohr February 22, 2010 PROJECT 5 Writing C++ Programs Using C-Strings and Evaluating Expressions Objective : Learn to write C++ programs that use C-Strings and evaluate expressions. Assignment : Write a C++ program that will read from an input file C-Strings containing arithmetic expressions, evaluate the expressions, and report the results on the console and an output file. Requirements : 1. Include only iostream and fstream : No other libraries may be used. 2. Read input from the file File5.In . 3. Write all output to the console and the file File5.Out . 4. If either file cannot be opened, terminate the program. 5. Read all input lines as C-strings using fin.getline() only, where fin represents the file variable for the input file. 6. Write output using only the following three types of statements:
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cout << <Literal Text> ; with or without endl ; cout << <Double Value>; with or without endl ; cout << endl; 7. Evaluate syntactically valid arithmetic expressions containing real numbers and the operators +, -, *, and /. 8. Use the normal mathematical precedence for the operators. 9. Do not support parentheses. 10. Do not use any functions in the evaluation of the numbers. Suggestions : 1. Begin with the Homework 3 program. 2. Delete functions not needed. 3. Add new functions required: Do NOT use any library functions other than the iostream and fstream functions specified above. 4. Use a modified version of the Homework 3 evaluate function to evaluate the numbers on the input lines. Grading : 25%: Program design; 25%: Program implementation; 10%: Test data; 40%: Results: 20 tests @ 2% each Due Date : Thursday March 4, 2010: 9:00 PM : Projects must be submitted electronically....
View Full Document

This note was uploaded on 03/08/2010 for the course COM SCI 31 taught by Professor Kinsey during the Spring '98 term at UCLA.

Ask a homework question - tutors are online