[solved] – Question 71515

Design, implement and test a C++ program which will process a list of names, sort them using selection sort, and save the output to a file.
Requirements
Process a data file of “student” names. See provided sample file
Include a function to sort the names in ascending or descending order using selection sort
Include another function to display the names BEFORE as well as AFTER it is sorted
Include yet another function to save the sorted names to a data file named Output_SortedNames.txt.”
Including main (), 4 or more functions must be implemented. Proper prototypes should be utilized and function bodies must be coded after the main function
Assume that the input data file will contain between 20 and 50 names where each name is written on a separate line and is constructed correctly

Input Validations –
“Reasonable” input and output validations are expected for this project
For example, if there is an error while attempting to open the input file, display an appropriate error message

Expert Answer


[solved] – Question 71516

Write a program that lets the user enter a charge account number. The program should determine if the number is valid by checking for it in the following list:
5658845 8080152 1005231 4520125 4562555 6545231
7895122 5552012 3852085 8777541 5050552 7576651
8451277 7825877 7881200 1302850 1250255 4581002
Initialize a one-dimensional array with these values. Then use a simple linear search to locate the number entered by the user. If the user enters a number that is in the array, the program should display a message saying the number is valid. If the user enters a number not in the array, the program should display a message indicating it is invalid.

Expert Answer


[solved] – Question 71518

when opening a file, the “wt” parameter indicated that we:

want to append to the end of the text file.

want to write data to a text file.

that we are opening a binary file.

that we are reading from a text file.

Expert Answer


[solved] – Question 71540

International Book Fair which was held for 30 days attracted many visitors. Only those
visitors with passes were allowed to enter. Number of passes issued for each day was
recorded. Based on the records, write a C++ program that will analyze the success of the
book fair. Your program should contain the following:
(a) read input needed and prints all the related information.
(b) calculates the total visitors who went to the book fair.
(c) calculates the average number of visitors.
(d) calculates the number of days which has the number of visitors more than 50.

Expert Answer


[solved] – Question 71549

Write pseudo code and draw flowchart for each of the problems. Based on your algorithm write a C++ code to perform the required task.

1. Receive a number and determine whether it is odd or even.
2. Obtain two numbers from the keyboard, and determine and display which (if either) is the larger of the two numbers.
3. Receive 3 numbers and display them in ascending order from smallest to largest
4. Add the numbers from 1 to 100 and display the sum
5. Add the even numbers between 0 and any positive integer number given by the user.
6. Find the average of two numbers given by the user.
7. Find the average, maximum, minimum, and sum of three numbers given by the user.
8. Find the area of a circle where the radius is provided by the user.
9. Swap the contents of two variables using a third variable.

Expert Answer


[solved] – Question 71576

Write a code that will calculate randomly a number between 1 and 10 (without displaying it) and will ask the user to guess it. If the user answers correctly, the program prints “Good” and add 1 to his score, if not, the program prints “sorry”, gives the correct answer, then selects another number. After 10 consecutive games, the programs stops and prints the final score. Hint: use a random buitin function (rand) and write the #include <stdlib.h> at the beginning.
your guess? 7 Sorry, answer was 5 your guess? 6 Sorry, answer was 0 your guess? 3 Sorry, answer was 1 your guess? 9 Sorry, answer was 0 …..
your guess? 1
Sorry, answer was 5
your final score is 0
using while,for,array if possible

Expert Answer


[solved] – Question 71577

Write a program which repeatedly reads numbers until the user enters 0. Once 0 is entered, print out the total, count, and average of the numbers. Use an array to store all the numbers. Example of execution:
Enter a number: 4
Enter a number: 5
Enter a number: 9
Enter a number: 0
Total = 18, count = 3, average= 6
answer by using while,for and array if possible

Expert Answer


[solved] – Question 71580

Write a program that asks the user to enter an array of random numbers, then sort the numbers (descending order), after that reverse it (the first element will be the last…).
using while, for and array if possible

Expert Answer


[solved] – Question 71581

8/Write a program that asks the user to enter integer numbers and store the numbers in a two dimensional array, then replace any 9 digit by 0 digit. After that replace the numbers with the odd summations indices by the even summation indices.
using while, for and array if possible

Expert Answer


[solved] – Question 71582

This program will always print a menu of 5 options. If user chooses for example 1 (addition), the program will ask him to enter 2 numbers that the program will add to each other. Then, the menu options are printed again and so on… If user chooses 5 (quit), the program will stop. Below an example of execution (user’s input is in red). Write the program where the menu is a function, as well as the 4 calculus operations (addition, subtraction…)
Welcome to calculator your options are: 1) Addition
2)Subtraction
3)Multiplication
4)Division
5)Quit calculator
Choose your option: 1
Add this: 3 to this: 4 3 + 4 = 7 Welcome to calculator your options are: 1) Addition
2)Subtraction
3)Multiplication
4)Division
5)Quit calculator
Choose your option: 2 Subtract this: 6 from this: 9
9 – 6 = 3
using while,for and array if possible

Expert Answer