### Assignment F

For each problem:

• Use the lab instructions given on the Internet at http://voyager.deanza.edu/~oldham
• Use the same format for the opening comments as in assignment A, with your name, course and quarter, assignment, problem, and short problem description.
• Create a program to meet the requirements of the problem.
• Correct any errors.
• Run the program with the specified data and save the execution results in an Execution Results comment at the end of your program.
• Print the program from Code::Blocks.
• Staple all the problems for this assignment together.

### Problem F1

Write a do while loop to require the user to enter two integers; the second integer must be equal to, or larger than, the first integer. Both integers must be at least 1 and not larger than 20. If they do not enter correct integers, give them error messages and make them do it again until they are correct.

After the acceptable integers have been entered, use a for loop to print a table of integers and their square roots for all integers from the first integer specified by the user to the last integer specified by the user, inclusive. Align the table and print 4 decimal positions

A sample table follows, for integers 7 to 9:

```INTEGER  SQUARE ROOT
7       2.6458
8       2.8284
9       3.0000
```

Test the program twice:
First test, first enter: first integer = 2, second integer = 0
and after that is rejected: first integer = 2, second integer = 4

Second test, first enter: first integer = 21, second integer = 5
and after that is rejected: first integer = 5, second integer = 5

### Problem F2 = Chapter 5 Programming Challenge 6

Make the speed and the time both integers.
Test data, run the program twice:
First test, speed -2 and time -1; when that is rejected, speed -1 and time 0; when that is rejected, speed 0 and time 1.
Second test speed 20, time 5

### Problem F3

Provide a loop with a menu. Repeat until the user selects Quit. Prompt the user to select one of the menu items. Test for numbers that are not in the menu, provide an error message, and then continue. The menu shall contain:

```1. Square   pattern
2. Triangle pattern
3. Diagonal pattern
4. Reverse diagonal pattern
5. Quit
```

After the user selects a pattern, allow them to specify the size. If the size is smaller than 1 or larger than 9, give them an error message and repeat the specification of the size.

Once the user has correctly selected a pattern and a size, print the pattern using the size specified.

Pattern 1 is a square. Example for size 4:

```4444
4444
4444
4444
```

Pattern 2 is a triangle. Example for size 5:

```5
55
555
5555
55555
```

Pattern 3 is a square with a diagonal of numbers in stars. Example for size 6:

```6*****
*6****
**6***
***6**
****6*
*****6
```

Pattern 4 is a square with a reversed diagonal of numbers in stars. Example for size 7:

```******7
*****7*
****7**
***7***
**7****
*7*****
7******
```

Test the program once using each of these values in order:
Pattern 9; when that is rejected try:
Pattern 1, size 11; when that is rejected use:
Pattern 1, size 3
Pattern 2, size 4
Pattern 3, size 5
Pattern 4, size 6
Quit