Question
1) Read the entries of an array of 10 integers from a user. Compute x as the average of the 10 entries (and print the
1) Read the entries of an array of 10 integers from a user. Compute x as the average of the 10 entries (and print the first average) and then compute the average of those entries that are greater than or equal to x. Print this final average.
(2) Write a C or C++ program that sets up an array of integers with capacity 20. It should then generate the 20 entries randomly in turn. Each entry must be an integer between l and 20, however it must also be different from all previous entries in the array. Generate the entries as random numbers and repeatedly make new numbers until a legal entry value is found. The program should finish by printing the list of 20 array values that it has selected. In other words when you print out the final array, there should be random numbers (from 120) with NO repeats.
(3) Eight queens are to be placed on an 8 x 8 chessboard in such a way that one queen is to be in each row. A program will store an array x[] with capacity of 8 to represent such a configuration. If x[r] has value c then in row r there is a queen in column c. If x[2] has a value of 7, then on row 2 there is a queen in the 7th column. There is no need to use a multi scripted array. A single scripted array should work fine. Write a program that asks a user to enter the columns that contain queens in the 8 rows.The program then prints the board. For example, if the user enters: 0,3,4,0,0,7,6,7 the program should print:
Q.......
...Q....
....Q...
Q.......
Q.......
.......Q
......Q.
.......Q
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started