0% found this document useful (0 votes)
20 views

Binary String Search

Uploaded by

emailpiro
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Binary String Search

Uploaded by

emailpiro
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Binary String Search

Basic Steps in Creating your Program


1. Plan your logic before working on the project and review the syntax
you will use in the project. Think about how you want the lines of
output to be displayed to the user. You will want to tell the user what
the program does and what type of input you expect from the user
(Introduction to the User). Select names of the variables you will use in
the program.
2. Create a C++ project in Visual Studio 2012. And have the code window
open to write the project code. Display Using Visual Studio to create
your program in C++ and follow the instructions on creating the
project.
 Declare variables to hold information about USER.
 Using cout Set up information about this program and what the
user will enter and results expected
 Ask the user to enter some information requested and save the
response to a variable using the cout and getline(cin, name)
syntax. If the cin is used for a number, make sure you use the
ignore() syntax. Make sure the position for the user to enter
information is on the same line as the request for information.
 Use line spacing (endl or \n) to separate lines of output to make
it easy for the user to read the information.
3. Documentation: All lines of code must be documented.
 Use the syntax to designate lines in code as comments ( //)
 These comments can be at the end of a line of code or in a group
definition at the beginning of a section of code. All methods and
function need a group heading document.
4. Run the program using Ctrl+F5. Debug the code, making sure all
calculations are correct and the line spacing is suitable for readability.
5. Include the looping control structure so that the user can repeat the
entry of information without the program exiting. Ask the user if
they want to run the program again or exit.
6. In displaying the output correctly formatted. Remember to use the
setprecision(), fixed and setw() to correctly format numbered output if
needed.
Your program Assignment

Modify the binarySearch function presented in the chapter so it searches an


array of strings instead of an array on ints. Test the function with the driver
program. Use the Program 8-8 as a skeleton to complete. (The array must be
sorted before the finery search will work.

You might also like