Microsoft Visual C#
7th Edition
ISBN: 9781337102100
Author: Joyce, Farrell.
Publisher: Cengage Learning,
expand_more
expand_more
format_list_bulleted
Question
Chapter 6, Problem 1E
Program Plan Intro
Program Plan
1. Below mentioned variables are used
- intArray− integer array that holds 10 integers as array elements.
- input− input value for array element read from the console.
- position − position of array element given as input from the user to search for the element.
- Pos −position value converted to int type.
Program description:
This program is for creating a console application that creates an array of ten elements and these elements are given as input through the console. It offers four options to the user that is to view the array elements in order and to view by the position of the element or to view in the reverse order. The fourth option is to quit the application.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
do both tasks
Problem2
Write a program that display the position of a given element in an array. You should print the index (i.e. the
position) of the element. If the element appears more than one time than you should print all its positions.
The size of the array should be entered by the user. If the element does not occur then you should display
element not found.
Sample1:
Enter the size of the array: 5
Enter an array of size 5: 44 5 13 44 67
Enter the element to find: 44
44 is found at position
44 is found at position
44 occurs 2 time(s)
Sample2:
Enter the size of the array: 4
Enter an array of size 4: 12 150 17 20
Enter the element: 18
18 is not found
The array size declarator must be an integer expression with a value greater than or equal to zero.
True
False
Chapter 6 Solutions
Microsoft Visual C#
Knowledge Booster
Similar questions
- Programming :Visual basic You can choose between the 2 option.. Only 1 program is needed please check the photoarrow_forwardUsing C# in Microsoft Visual Studio Create an application that simulates a game of tic-tac-toe. The application should use a two-dimensional int array to simulate the game board in memory. When the user clicks the New Game button, the application should step through the array, storing a random number in the range of 0 through 1 in each element.The number 0 represents the letter O, and the number 1 represents the letterX. The form should then be updated to display the game board. The application should display a message indicating whether player X won, player Y won, or the game was a tie.arrow_forward3x3 2d array filled with random numbers from 0-9 without repetitions using functions and pointers let the user choose from 5 options.1-fill the array with random numbers.2-print the array.3-print the largest number in the array.4-print the diagonal line from the array.5-type "." to exit the program.arrow_forward
- Any loop statement can be used to traverse an array. True or Falsearrow_forwardIn visual basic Write the code that will sequentially search through the array strFirstNames and will print out the word "Found" if the name "Brian" is in the array.arrow_forwardC++ Code with comments and output screenshot is must for an Upvote. Thank youarrow_forward
- The index type of an array can be any data type. True or false?arrow_forwardThis program will be a Doggy Day Care. The menu should be Check in Dog Check Out Dog Exit If the user selects option 1 (Check in Dog), the program will take in all of the information for the dog and create a dog object (which will be stored in the array). All relevant input validation should be done for the information entered. Once the dog object is created, the program should tell the user how much it will be for the dog for the day. The Doggy Daycare can only contain up to 30 dogs. Before a new dog object is created, the program should check that the number of current dog objects is less than 30 (Hint: using the static field). If there are already 30 dogs, then if the user selects option 1, it should say “Sorry, the Doggy Day Care is at capacity”. If the user selects option 2, it will ask for the owner’s name. It will search the array for that name and return the names of the dogs that the owner has checked in. This will check out those dogs (i.e. remove them from the array). Figure…arrow_forwardProgramming: Multi-Array Assignment Instructions Overview Using a two-dimensional array, you will create the game battleship using a text file that contains the board. The user will enter coordinates to try and find ships and sink them. Instructions Imagine you are using a two-dimensional array as the basis for creating the game battleship. In the game of battleship, a `~' character entry in the array represents ocean (i.e., not a ship), a `#' character represents a place in the ocean where part of a ship is present, and a `H' character represents a place in the ocean where part of a ship is present and has been hit by a torpedo. Thus, a ship with all `H' characters means the ship has been sunk. Declare a two-dimensional array that is 25 x 25 that represents the entire ocean and an If statement that prints "HIT" if a torpedo hits a ship given the coordinates X and Y. Create a text file of 25 line. Each line has 25 characters. ~ represents water and # represents part of…arrow_forward
- Programming: Multi-Array Assignment Instructions Overview Using a two-dimensional array, you will create the game battleship using a text file that contains the board. The user will enter coordinates to try and find ships and sink them. Instructions Imagine you are using a two-dimensional array as the basis for creating the game battleship. In the game of battleship, a `~' character entry in the array represents ocean (i.e., not a ship), a `#' character represents a place in the ocean where part of a ship is present, and a `H' character represents a place in the ocean where part of a ship is present and has been hit by a torpedo. Thus, a ship with all `H' characters means the ship has been sunk. Declare a two-dimensional array that is 25 x 25 that represents the entire ocean and an If statement that prints "HIT" if a torpedo hits a ship given the coordinates X and Y. Create a text file of 25 line. Each line has 25 characters. ~ represents water and # represents part of…arrow_forwardAn array can hold as much different data types as you want. True Falsearrow_forwardThe task is to create a program that will randomly select four cards from a deck of 52 cards. All the cards can be represented using an array named deck, filled with initial values 0 to 51, as follows:Card numbers 0–12, 13–25, 26–38, and 39–51 represent 13 Spades, 13 Hearts, 13 Diamonds, and 13 Clubs, respectively, as shown in Figure 1. cardNumber / 13 determines the suit of the card, and cardNumber % 13 determines the rank of the card, as shown in Figure 2. After shuffling the array deck, pick the first four cards from deck. The program displays the cards from these four card numbers. Implement the following code in Eclipse, and ensure it runs without errors. Think about the following questions and write down your answers in a few sentences. 1) Describe how the above program shuffles the cards. 2) Describe how deck[i] / 13 and deck[i] % 13 work to display the suit and rank of cards.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning