design a program using pseudocode that asks the user to enter 10 golf scores. the scores should be stored in an integer array. sort the array in ascending order and display its contents. perform input validation for golf scores.(no negative scores, just for the purpose of validation)

Respuesta :

START

//Declare array to store 10 golf scores

integer array golfScores[10]

//Declare counter variable

integer i

//Loop 10 times to get 10 golf scores

FOR i=0 to 9

   //Ask user to input golf score

   PRINT "Please enter a golf score:"

   INPUT golfScores[i]

   //Validate inputs

   WHILE golfScores[i] < 0

       PRINT "Invalid input. Please enter a valid score (positive number):"

       INPUT golfScores[i]

   ENDWHILE

END FOR

//Sort array in ascending order

SORT golfScores in ascending order

//Display sorted array

FOR i=0 to 9

   PRINT golfScores[i]

END FOR

END

What is pseudocode and integer array?

  • Pseudocode is a way of expressing algorithms or processes using a combination of natural language and programming language.
  • It is often used to create a "skeleton" of a program and helps to define the specific instructions needed to solve a problem.
  • An integer array is a type of data structure in which the data is stored in an array of integer values.
  • This type of array is often used to store numeric information such as age, height, and weight.
  • Integer arrays are often used when dealing with large amounts of data, as they are more efficient than other types of data structures for searching and sorting. Integer arrays are also useful for representing data in a concise manner.
  • For example, an array of integers can be used to represent a list of ten numbers, such as the first ten prime numbers.
  • Integer arrays can also be used to store and manipulate large amounts of data in a more efficient manner, such as sorting, searching, and computing.
  • Integer arrays can also be used to store and manipulate data of varying types, such as strings and objects.

To learn more about pseudocode refer to:

https://brainly.com/question/24953880

#SPJ4

ACCESS MORE