Description
There are three parts to this assignment:
1. Start the process to get a SciNet account. (by the way, if you have questions regarding the account setup, please email support@scinet.utoronto.ca).
2. Get access to a local computer or laptop with a linux-like environment and the GNU c++ compiler, version 4.7 or higher.
3. Write a C++ program that generates a table of data.
This table should have three columns, one column with double precision values of a variable called t, ranging from -5 to 5 in steps of 0.005, a second column with values x=sin(2*t)/(1+t*t), and a third column with values y=cos(3*t)/(1+t*t). In particular, your program should:
Apart from “main”, there should be at least two functions, called “f” and “g”. The function “f” should take one double precision value t as an argument and return the corresponding value of x, while the function “g” should take t as an argument and return the corresponding y value.
The functions “f” and “g” should be in a separate module, using a header file and an implementation file, as discussed in the lecture.
The main program should be in a separate source file, and should use the functions f and g to compute the values of those functions for each of the t-values between -5 and 5, and store these values in dynamically allocated c++ arrays.
It should write out these arrays in tabular form, i.e. three-column ascii text, which a triplet of values (t,x,y) on each line. Have the code either write this to a file called “lissajous.txt” (preferably), or to standard output. Don’t try to add lines to the table to make it look better, and don’t spend time trying to align the table entries; just use a space to separate the t, x, and y values and a newline to separate the rows.
A few hints as to what coding style we are looking for:
Try to avoid duplicating the specific values for this assignment. Store repeated values in a variable, and use that variable (depending on your solution, this may mean passing these variables as arguments to your functions).
Give your variables understandable names.
Do not use global variables.
Indent your code properly. Mostly, that means that you should indent consistently and in such a way that all code in the same block has the same indentation.
Be sure to comment your code!
In general: try and write a code that your future self could still read and understand it in, say, 1 year.
Compile and run your code using g++ with the -std=c++11 flag, and capture the output. Submit, by 18 January 2018 at 11:55 pm, the following files:
the files with the code of the program,
the output file produced by the program,
a text file describing what you did, including the compilation commands (which use the c++11 flag), and the command used to run the code.
The content of all files should be in plain text format. The file(s) that contain code should have an extension .cc, .cxx, or .ccp. The other text files should have the extension .txt. Note that doc, docx, xls, xlsx, … files do not contain plain text content (even if they only contain text). Even .rtf files (which stands for “rich text format”) are NOT plain text files. Renaming them to .txt will also not change the content to plain test. Use the “Assignment Dropbox” on the course website to upload your work. You may combined your file into an archive format like tar, tgz, or zip. Other formats are not supported. Remember the late penalty policy: you can submit upto seven days late, but you will get a half point taken off for each day you submitted late. Also note that if you submit the different parts of your work at different times, the last submission date is taken as the submission of the whole.