Description
For this computer assignment, write a C++ program to read a positive integer and
then calculate and display the sum of the first odd integers. For example, if is your
program should display the value which is Your program should
prompt and get the value from and display its value and the sum on
You can name your source/header files anything you want as far as they have proper
extensions: for source files and for header files. Guard the statements in your
header file using the following format. (This is necessary because you don’t want the
statements in a header file are processed more than once.)
Include all system header files (that you need in your program) in your header files. For
example, to gain access to the library, which defines a set of simple I/O
operations, insert the line in your header files, and at the top of each
source file, insert corresponding header files by the following statement:
To compile your source file and link its object file with the system library routines, you
need to create a Insert the statements in this file in the following format, where
the first line defines a macro that includes several options we use for the C++ compiler,
and in the rest each entry consists of a line containing a colon (the dependency line), and
one/more command lines beginning with a tab. To the left of the colon on the
dependency line is a target (an executable file); to the right of the colon are the target’s
prerequisites. For target, you can choose any valid name, and the advantages of using a
will be discussed in class. After creating this file, simply execute the UNIX
command without any arguments.
For a final test of your program, first make a link to the data file of this assignment by
executing: ~ where contains the test value
Then, execute it as:
When the execution is successful, the output file will contain the
2
value of the summation. You can find the correct output in file which is in the
same directory with
Submit your source and header files to your TA by executing: