Algorithm to Determine the Largest of Three Numbers: Steps and C++ Implementation, Lab Reports of Computer Science

A problem to develop an algorithm that determines the largest of three numbers, providing steps to input the numbers and expressing the algorithm as a c++ program. It also includes instructions to compile and run the program, test it with various inputs, and submit the files for assessment.

Typology: Lab Reports

Pre 2010

Uploaded on 02/24/2010

koofers-user-tmb
koofers-user-tmb 🇺🇸

9 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
A problem to work on:
Develop an algorithm that will determine the largest of three numbers;
include steps to input the three numbers.
What is an algorithm? -
A detailed sequence of actions to perform to accomplish some task.
Named after an Iranian mathematician, Al-Khawarizmi.
Technically, an algorithm must reach a result after a finite number of
steps, thus ruling out brute force search methods for certain problems,
though some might claim that brute force search was also a valid
(generic) algorithm. The term is also used loosely for any sequence of
actions (which may or may not terminate). - From FOLDOC,
http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?query=algorithm
Express the algorithm as a C++ program.
Implement your C++ program on paprika.umw.edu or another system on
the CPSC LAN.
Go to B13. Login in using your user name and password for the
campus network
Open a window on your desktop
Use vi, vim, or the text editor tool to enter the source of your
program. Save it in a file named largest.cpp.
Compile the program and if the compilation is successful, put the
run file in largest.R
cpp largest.cpp -o largest.R
If there are no errors or warnings then execute the program and
capture the results in a script file. Enter the following
script
largest.R
.. enter the three values
exit
recall that this creates a file named typescript, that contains
everything that appeared in the current window. Remember that
you have to enter exit to terminate the script.
print the files named typescript and largest.cpp. (! Don't you dare
try to print largest.R !) Turn in the hard copy of these files.
lp largest.cpp typescript
output is in B14.
pf3
pf4

Partial preview of the text

Download Algorithm to Determine the Largest of Three Numbers: Steps and C++ Implementation and more Lab Reports Computer Science in PDF only on Docsity!

A problem to work on:

Develop an algorithm that will determine the largest of three numbers; include steps to input the three numbers. What is an algorithm? - A detailed sequence of actions to perform to accomplish some task. Named after an Iranian mathematician, Al-Khawarizmi. Technically, an algorithm must reach a result after a finite number of steps, thus ruling out brute force search methods for certain problems, though some might claim that brute force search was also a valid (generic) algorithm. The term is also used loosely for any sequence of actions (which may or may not terminate). - From FOLDOC, http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?query=algorithm Express the algorithm as a C++ program. Implement your C++ program on paprika.umw.edu or another system on the CPSC LAN.  Go to B13. Login in using your user name and password for the campus network  Open a window on your desktop  Use vi, vim, or the text editor tool to enter the source of your program. Save it in a file named largest.cpp.  Compile the program and if the compilation is successful, put the run file in largest.R cpp largest.cpp -o largest.R  If there are no errors or warnings then execute the program and capture the results in a script file. Enter the following script largest.R .. enter the three values exit recall that this creates a file named typescript, that contains everything that appeared in the current window. Remember that you have to enter exit to terminate the script.  print the files named typescript and largest.cpp. (! Don't you dare try to print largest.R !) Turn in the hard copy of these files. lp largest.cpp typescript output is in B14.

 Test the program using different types of inputs: all the numbers the same, all of the numbers negative, the last input a non-numeric character, the second input a non-numeric character, the first input a non-numeric character. Enter the following largest.R .. enter the three values for the first test largest.R .. enter the three values for the second test largest.R .. enter the three values for the third test largest.R .. enter the three values for the fourth test largest.R .. enter the three values for the fifth test exit  While you're logged on to a system in B13, send me an email in which you describe the results of each of the tests. There are at least 2 email clients available on the systems that make up the CPSC LAN. They are elm and pine. When you use elm you'll use vi to compose a message, and when you use pine you'll use pico to compose a message. It's your choice; send me the email using either elm [email protected] or pine [email protected] for next class read Ch 1 p 1-38, Ch 2 p 43-

  1. Move the mouse cursor to the desktop, outside of any window, and right click.
  2. Select Internet Services and then Mozilla Select Mozilla
  1. Select Advanced, then Cache and set the cache to 0.5 MB and clear the cache
  2. Visit the home page for the course. If there is time left, help someone else or otherwise entertain yourself.

F

ir s t Second, set cache limit to 0.5 MB Third, clear cache