Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ please CSE 232, Lab Exercise 3 More Command Line Pagers Often, you want to be able to view files in the terminal (instead of

image text in transcribedimage text in transcribedimage text in transcribedc++ please

CSE 232, Lab Exercise 3 More Command Line Pagers Often, you want to be able to view files in the terminal (instead of opening them in a text editor like Atom or gedit). There are a few ways view files from the terminal cat The command cat is short for concatenate, which means to link things together The cat program is often used to link the output from one program to the input from another. But another useful trait of cat is to output the contents of a file to the terminal Invoking the cat program is quite simple cat some file name.txt The above command will print the contents of the file to the terminal. However, for large files, cat is not very user-friendly. Instead, you should use a pager less Pagers are programs that show you content one page at a time. They are useful for viewing large files (files too big to fit in the terminal window). The most popular pager is called less because it was derived from an older program called more, computer science history is a little silly. You can invoke the less program like so less some file name.txt To go the the next page, push the f key (forward). To go back a page, push the b key (backwards). To quit the pager and return to the command line, push q (use your imagination for why it is the q key) Help There are a few programs that are intended to provide documentation on the programs install on your computer. However, they are often difficult to understand, especially for a beginner. You invoke them by typing the help program and the name of the program you want information about. They may open up a pager if the entry is long hel This command is used to provide information about tesh, which is the language the terminal in MobaXTerm is running (Mimir uses another called bash) man This command (short for manual) is used to retrieve the documentation about the programs installed on the computer. They can be long (try man g++ for example. It comes automatically with the pager keys described above) You can search through large man files looking for a keyword. When the pager stops at the bottom of the page you can type a /keyword. For example, if you type man g++ (a big page), then you type /memory while the pager is active (command will show up in the bottom of the window) it will page to the next example of the word memory in the file. If you then hit the n key, it will go to the next example of memory in the file. You can keep hitting n looking for the next example of a keyword. The q quits as before. If you want to see more commands, hit the h key while the pager is active and it will give you help in the pager info This command is an alternate to man, often used by unix distributions Examples help cd info ls man python3 -h or--help Many programs will give you a bit of documentation about themselves (like what arguments they accept) if you invoke the program with the -h or -help flags. Example python-h g++--help I Please show your TA the man entry for the more program and that you can page forwards and backwards through the entry Lab Assignment Background You remember calculus don't you? The basic concept of an integral is the area under the curve, the curve represented by some function. If you can integrate a function, you can calculate that area directly, but for some functions it is easier to approximate that area using discrete, iterative methods. We are going to investigate one of those methods, the Trapezoid Rule (http://en.wikipedia.org/wiki/Trapezoidal rule) Trapezoid Rule, area of a Trapezoid The basic idea is to draw a series of trapezoids that approximate the area under a curve, where the more trapezoids we draw, the better the approximation. First, remember how to calculate the area of a trapezoid? One measures the length of the parallel sides (bi and b2), then the distance between the parallel sides (h). Add the parallel distances, multiply those values by h, divide by 2 Let's rotate that trapezoid 90 and model it as below. Now the bi length is the curve value fa), the b2 length f(b) and the height h the difference between b - a Given the above, the area would (b-a)*f(a)+f(b) (a) f(b)% For two trapezoids next to each other with heights f/a), f(b) and f(c), f(b) a common side used by the two trapezoids, we get the formula In general, for the definite integral 1. from a to b 2. with n equally space trapezoids (n+/ points on the x axis) 3. grid spacing of h-(b-a) CSE 232, Lab Exercise 3 More Command Line Pagers Often, you want to be able to view files in the terminal (instead of opening them in a text editor like Atom or gedit). There are a few ways view files from the terminal cat The command cat is short for concatenate, which means to link things together The cat program is often used to link the output from one program to the input from another. But another useful trait of cat is to output the contents of a file to the terminal Invoking the cat program is quite simple cat some file name.txt The above command will print the contents of the file to the terminal. However, for large files, cat is not very user-friendly. Instead, you should use a pager less Pagers are programs that show you content one page at a time. They are useful for viewing large files (files too big to fit in the terminal window). The most popular pager is called less because it was derived from an older program called more, computer science history is a little silly. You can invoke the less program like so less some file name.txt To go the the next page, push the f key (forward). To go back a page, push the b key (backwards). To quit the pager and return to the command line, push q (use your imagination for why it is the q key) Help There are a few programs that are intended to provide documentation on the programs install on your computer. However, they are often difficult to understand, especially for a beginner. You invoke them by typing the help program and the name of the program you want information about. They may open up a pager if the entry is long hel This command is used to provide information about tesh, which is the language the terminal in MobaXTerm is running (Mimir uses another called bash) man This command (short for manual) is used to retrieve the documentation about the programs installed on the computer. They can be long (try man g++ for example. It comes automatically with the pager keys described above) You can search through large man files looking for a keyword. When the pager stops at the bottom of the page you can type a /keyword. For example, if you type man g++ (a big page), then you type /memory while the pager is active (command will show up in the bottom of the window) it will page to the next example of the word memory in the file. If you then hit the n key, it will go to the next example of memory in the file. You can keep hitting n looking for the next example of a keyword. The q quits as before. If you want to see more commands, hit the h key while the pager is active and it will give you help in the pager info This command is an alternate to man, often used by unix distributions Examples help cd info ls man python3 -h or--help Many programs will give you a bit of documentation about themselves (like what arguments they accept) if you invoke the program with the -h or -help flags. Example python-h g++--help I Please show your TA the man entry for the more program and that you can page forwards and backwards through the entry Lab Assignment Background You remember calculus don't you? The basic concept of an integral is the area under the curve, the curve represented by some function. If you can integrate a function, you can calculate that area directly, but for some functions it is easier to approximate that area using discrete, iterative methods. We are going to investigate one of those methods, the Trapezoid Rule (http://en.wikipedia.org/wiki/Trapezoidal rule) Trapezoid Rule, area of a Trapezoid The basic idea is to draw a series of trapezoids that approximate the area under a curve, where the more trapezoids we draw, the better the approximation. First, remember how to calculate the area of a trapezoid? One measures the length of the parallel sides (bi and b2), then the distance between the parallel sides (h). Add the parallel distances, multiply those values by h, divide by 2 Let's rotate that trapezoid 90 and model it as below. Now the bi length is the curve value fa), the b2 length f(b) and the height h the difference between b - a Given the above, the area would (b-a)*f(a)+f(b) (a) f(b)% For two trapezoids next to each other with heights f/a), f(b) and f(c), f(b) a common side used by the two trapezoids, we get the formula In general, for the definite integral 1. from a to b 2. with n equally space trapezoids (n+/ points on the x axis) 3. grid spacing of h-(b-a)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

1. Define and explain culture and its impact on your communication

Answered: 1 week ago