Starting from:
$35

$29

Assignment 1 Math and Variables Solution

Programming is very powerful, especially in regards to math. In this assignment you will solve some math problems using C++ libraries. You can find documentation for the libraries at http://www.cplusplus.com/reference/ The goal of this assignment is to get you accustomed to setting up C++ programs, printing and using variables, and using documentation.

(65 pts) Show your work

Include the cmath library to implement the following tasks. In your corresponding pdf, explain what the cmath library is, which elements you used along with how and why you used them.

Print the solutions to the following equations, making sure to label your work when it is printed to the screen:

cos(2/3)
2sin(2/3)
tan(-3/4)

log10 55
ln 60

Print each step in solving the following equations, making sure to label your work when it is
printed to the screen:

*use logb x = (ln x)/(ln b)

log2 15

log4 40


Example Output































Print each step in solving the following equations for x = 1, x = 10, x = 100, reusing the x variable in your code, making sure to label your work when it is printed to the screen:
3sinx
log2 (x2 +1)

(25 pts) Vim and Terminal Commands

In this course, through out OSU, and in industry you will be expected to use a terminal. During your demo, you will be required to demonstrate your knowledge of these commands. You are not allowed to use notes or the manual pages. Select some of the following tasks up to 15 points to demonstrate to the TA. The TA will then randomly select a number of tasks remaining up to 10 points for you to demonstrate. Points will be award based on completion of the task within the constraints of the task. It is assumed you can successfully log in to the server via terminal. Failure to do so will result in a 5 point deduction. You must bring your own laptop to demo for this assignment.

Tasks

    A. (2 pt) List all files in your home directory.

    B. (3 pts) List all hidden files in your home directory.
    C. (3 pts) List all files and their permission in your home directory.

    D. (2 pts) Make a directory called “CS17-18.”

    E. (3 pts) In a directory (not home), create a new directory named “demoEx.”

    F. (4 pts) From your home directory, create a subdirectory in any directory visible in your home directory (do not change into the directory you are adding the subdirectory to).
    G. (3 pts) Create a copy of any file and rename it to indicate it is a copy of the original.

    H. (7 pts) Create a new file named test.txt. Write “hello world” in the file. Save your work. Display the contents of the file to the screen without opening the file. Delete the file.

    I. (8 pts) Create a directory called “Test.” In the directory add three files. From your home directory, delete the “Test” directory and all of its contents.

    J. (10pts) From the command line, get the file from this link: http://www.gutenberg.org/files/1400/1400-0.txt Open the file. Add line numbers. Without scrolling, go to line 242. Without scrolling, go to the end of the file. Without scrolling go to the top of the file. Exit the file. Delete the file.

    K. (2 pts) Print current directory.

    L. (3 pts) Create a file named “mistake.txt”. Rename the file “correct.txt”.

    M. (4 pts) Create a directory in your home directory named “Test”. In your home directory create a file named “test_file.txt”. From the command line, move the test_file.txt to the

Test directory.

    N. (1 pt) Successfully open the manual pages.

    O. (10 pts) From the command line, get the file from this link: http://classes.engr.oregonstate.edu/eecs/winter2018/cs161-001/assignments/example_assignment_file.cpp Open the file. Change the color scheme of the file to desert. Add line numbers. Close the file. Compile the file. When running the file, redirect the output to results.txt Display the contents of results.txt without opening.

    P. (5 pts) From the command line, display two terminal screens at once. Close one of the terminal screens.

(10 pts) Header and Style

Your program should include a header as follows:

/*********************************************************************

    • Program Filename:

    • Author:

    • Date:

    • Description:

    • Input:

    • Output:

*********************************************************************/

Code should adhere to the course style guidelines: http://classes.engr.oregonstate.edu/eecs/winter2018/cs161-001/assignments/161_style_guideline.pdf

More products