Implementing the program
The first step on the road to turning our designs into a working program is to start with getting the code for the sorting algorithm ready. As stated before, we’re going to use ChatGPT to quickly generate code for the sorting algorithms.
Using ChatGPT to implement bubble sort
The pseudocode stated that the sorting algorithm we are going to use is the bubble sort algorithm. As was explored in Chapter 14, the bubble sort algorithm isn’t necessarily hard to implement, but it can be tedious. So, to speed things along, we’re going to use ChatGPT to generate code for us.
Before using the following prompt, try to design the prompt on your own to get a bubble sort algorithm. To generate our bubble sort algorithm, we’re going to use the following prompt:
Generate a bubble sort algorithm in Structured Text for an array with five elements.
This prompt will produce the following code:
PROGRAM BubbleSort VAR ...