100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Summary VisualBasic Notes $10.59   Add to cart

Summary

Summary VisualBasic Notes

 7 views  0 purchase
  • Course
  • Institution

The Document is about A-levels Computer Science paper 4 notes (codes) These codes will help you to ace your computer science paper 4 score. The codes are linked and consistent with alevels past papers with proper headings

Preview 3 out of 19  pages

  • June 6, 2023
  • 19
  • 2022/2023
  • Summary
avatar-seller
Visual basic code p4
Linear searching using for loop
Sub linearsearch_for_loop()
Dim data() As Integer = {22, 66, 55, 88, 99}
Dim found As Boolean = False
Dim i, searchno, indexnum As Integer
searchno = Console.ReadLine
For i = 0 To data.Length - 1
If searchno = data(i) Then
found = True
indexnum = i
Exit For
End If
Next
If found = True Then
Console.WriteLine("number found at " & indexnum)
Else
Console.WriteLine("number not found")
End If
End Sub
Linear searching using While loop
Sub linearsearch_while_loop()
Dim data() As Integer = {22, 66, 55, 88, 99}
Dim found As Boolean = False
Dim i, searchno, indexnum As Integer
searchno = Console.ReadLine
i=0
While i <= data.Length - 1 And found = False
If searchno = data(i) Then
found = True
indexnum = i
End If

TAHA IQBAL

, i=i+1
End While
If found = True Then
Console.WriteLine("number found at " & indexnum)
Else
Console.WriteLine("number not found")
End If
End Sub
Linear searching using Repeat loop
Sub linearsearch_repeat_loop()
Dim data() As Integer = {22, 66, 55, 88, 99}
Dim found As Boolean = False
Dim i, searchno, indexnum As Integer
searchno = Console.ReadLine
i=0
Do
If searchno = data(i) Then
found = True
indexnum = i
End If
i=i+1
Loop Until (i > data.Length - 1 Or found = True)
If found = True Then
Console.WriteLine("number found at " & indexnum)
Else
Console.WriteLine("number not found")
End If
End Sub




TAHA IQBAL

, Bubble Sort(Efficient)
Sub BubbleSort()
Dim Temp As String
Dim NoSwaps As Boolean
Dim Boundary, J As Integer
Boundary = 8
Do
NoSwaps = True
For J = 0 To Boundary
If Contact(J) > Contact(J + 1) Then
Temp = Contact(J)
Contact(J) = Contact(J + 1)
Contact(J + 1) = Temp
NoSwaps = False
End If
Next
Boundary = Boundary - 1
Loop Until NoSwaps = True
End Sub


Binary searching
Sub Main()
Dim data() As Integer = {33, 45, 55, 66, 77}
Dim lowerindex, highestindex, middleindex, searchindex,
searchno As Integer
Dim found As Boolean = False
lowerindex = 0
highestindex = data.Length - 1
searchno = Console.ReadLine
While highestindex >= lowerindex And found = False
middleindex = Int((highestindex + lowerindex) / 2)
If data(middleindex) = searchno Then
found = True

TAHA IQBAL

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller tahaiqbal1. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $10.59. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

67866 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$10.59
  • (0)
  Add to cart