Presentation is loading. Please wait.

Presentation is loading. Please wait.

Pseudo-code. Pseudo-code Task 1 Preparation Use the following code to declare, initialise and populate an array in a new VB.NET console application:

Similar presentations


Presentation on theme: "Pseudo-code. Pseudo-code Task 1 Preparation Use the following code to declare, initialise and populate an array in a new VB.NET console application:"— Presentation transcript:

1 Pseudo-code

2

3

4

5

6 Pseudo-code Task 1 Preparation Use the following code to declare, initialise and populate an array in a new VB.NET console application: Dim demoArray(9) As Integer For i As Integer = 0 To demoArray.Length - 1 demoArray(i) = Rnd() * 100 Next Add the following code to output the array’s contents in the order that they are stored in: For i As Integer = 0 To demoArray.Length - 1 Console.WriteLine(demoArray(i)) Next You will now write some code to sort the numbers in the array in to order! Don’t panic! You’ll have the pseudo-code!

7 Pseudo-code Task 1 Add the code to sort the array in-between the two For loops. The pseudo-code is on the next page. Dim demoArray(9) As Integer For i As Integer = 0 To demoArray.Length - 1 demoArray(i) = Rnd() * 100 Next ADD YOUR SORTING ROUTINE AT THIS POINT IN THE CODE For i As Integer = 0 To demoArray.Length - 1 Console.WriteLine(demoArray(i)) Next

8 Pseudo-code – Bubble Sort Hint: All the variables used are integers. N ← Len(A) For I ← 1 to N - 1 For J ← 1 to N - 1 If (A(J) > A(J + 1) Then Temp ← A(J) A(J) ← A(J + 1) A(J + 1) ← Temp End-If End-For

9 Pseudo-code Task 2 For this task you need to work as a group. Choose one of the programming tasks you have not completed yet and write a solution to it in pseudo-code. Give your pseudo-code solution to someone else in the group to write in VB.NET. In return, you need to take a pseudo-code solution from someone else and create it in VB.NET. You should find it much easier and quicker to code a solution when the programming logic is mapped out for you!


Download ppt "Pseudo-code. Pseudo-code Task 1 Preparation Use the following code to declare, initialise and populate an array in a new VB.NET console application:"

Similar presentations


Ads by Google