0% found this document useful (0 votes)
38 views10 pages

Urdu Work Homework

Assignment NOtes good Document proper

Uploaded by

Shakeel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views10 pages

Urdu Work Homework

Assignment NOtes good Document proper

Uploaded by

Shakeel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Dim StudentData(10) As String

1.1
Dim Count As Integer
Dim Name, Email, LineString As String

For Count = 1 To 3
Name = Console.ReadLine
Email = Console.ReadLine
LineString = Name + "#" + Email
StudentData(Count) = LineString
Next

Console.WriteLine("Student Name and Email")


For Count = 1 To 3
Console.WriteLine(StudentData(Count))
Next
Console.ReadKey()
Dim StudentData(10) As String
1.2
Dim Count As Integer
Dim Name, Email, LineString As String

For Count = 1 To 3
StudentData(Count) = ""
Next

For Count = 1 To 3
Name = Console.ReadLine
Email = Console.ReadLine
LineString = Name + "#" + Email
StudentData(Count) = LineString
Next

Console.WriteLine("Student Name and Email")


For Count = 1 To 3
If StudentData(Count) <> "" Then
Console.WriteLine(StudentData(Count))
End If
Next
Console.ReadKey()
Module Module1
1.3
Sub Main()
Dim StudentData(10) As String
Dim Count, X As Integer
Dim Name, Email, LineString As String

For Count = 1 To 3
StudentData(Count) = ""
Next

For Count = 1 To 3
Name = Console.ReadLine
Email = Console.ReadLine
LineString = Name + "#" + Email
StudentData(Count) = LineString
Next

Dim SearchItem As String


Dim Found As Boolean
Dim LengthName, LengthString As Integer
Console.WriteLine("Enter search term")
SearchItem = Console.ReadLine
Count = 1

Do
LengthName = Len(SearchItem)
If SearchItem = Left(StudentData(Count), LengthName) Then
LengthString = Len(StudentData(Count))
Found = True
Email = Right(StudentData(Count), LengthString - LengthName - 1)
Console.WriteLine(Email)
Else Count = Count + 1
End If
Loop Until Found = True Or Count > 3
If Found = False Then
Console.WriteLine("Search term not found")
End If

Console.ReadKey()
End Sub

End Module
Module Module1
1.4
Sub Main()
Dim StudentData(10) As String
Dim Count As Integer
Dim Name, Email, LineString As String

For Count = 1 To 3
StudentData(Count) = ""
Next

For Count = 1 To 3
Name = Console.ReadLine
Email = Console.ReadLine
LineString = Name + "#" + Email
StudentData(Count) = LineString
Next

Dim SearchItem As String


Dim Found As Boolean
Dim LengthName, LengthString As Integer
Console.WriteLine("Enter search term")
SearchItem = Console.ReadLine
Count = 1

Do
LengthName = Len(SearchItem)
If SearchItem = Left(StudentData(Count), LengthName) Then
Console.WriteLine(StudentData(Count))
Count = Count + 1
End If
Loop Until Count > 3
Console.ReadKey()
End Sub

End Module
Module Module1
1.5
Sub Main()
Dim StudentData(10, 4) As String
Dim Count, x As Integer
Dim Name, Email, DateOfBirth, ID As String

For Count = 1 To 10
For x = 1 To 4
StudentData(Count, x) = ""
Next
Next
For Count = 1 To 3
Name = Console.ReadLine
Email = Console.ReadLine
DateOfBirth = Console.ReadLine
ID = Console.ReadLine
StudentData(Count, 1) = Name
StudentData(Count, 2) = Email
StudentData(Count, 3) = DateOfBirth
StudentData(Count, 4) = ID
Next

Dim SearchItem As String


Dim Found As Boolean
Dim LengthName As Integer
Console.WriteLine("Enter search term")
SearchItem = Console.ReadLine
Count = 1

Do
LengthName = Len(SearchItem)
If SearchItem = Left(StudentData(Count, 1), LengthName) Then
Console.WriteLine(StudentData(Count, 1))
Console.WriteLine(StudentData(Count, 2))
Console.WriteLine(StudentData(Count, 3))
Console.WriteLine(StudentData(Count, 4))
End If
Count = Count + 1
Loop Until Count > 3
Console.ReadKey()
End Sub

End Module
Module Module1
2.1
Sub Main()
FileOpen(1, "D:\CS.txt", OpenMode.Output)
Dim ID, Email, LineString As String
Dim count As Integer

For count = 1 To 2
ID = Console.ReadLine
Email = Console.ReadLine
LineString = ID + "#" + Email
PrintLine(1, LineString)
Next

End Sub

End Module
Module Module1
2.2
Sub Main()
FileOpen(1, "D:\CS.txt", OpenMode.Input)
Dim SearchItem, Email, LineString As String
Dim count As Integer
Dim found As Boolean
SearchItem = Console.ReadLine
count = 1
found = False
Do
LineString = LineInput(1)
If SearchItem = Left(LineString, 6) Then
Email = Right(LineString, Len(LineString) - 7)
Console.WriteLine(Email)
found = True
End If
Loop Until EOF(1) Or found = True
If found = False Then
Console.WriteLine("ID not found")
End If
Console.ReadKey()
End Sub

End Module
Module Module1
2.3
Sub Main()
FileOpen(1, "D:\CS.txt", OpenMode.Input)
Dim SearchItem, LineString As String
Dim count, LengthSearchID As Integer
SearchItem = Console.ReadLine
count = 1
Do
LineString = LineInput(1)
LengthSearchID = Len(SearchItem)
If SearchItem = Left(LineString, LengthSearchID) Then
Console.WriteLine(Left(LineString, 6))
End If
Loop Until EOF(1)
Console.ReadKey()
End Sub

End Module
Sub Main()
2.5?
FileOpen(1, "D:\CS2.txt", OpenMode.Output)
Dim ID, Email, Address, Tutor As String

Console.WriteLine("Enter Student ID")


ID = Console.ReadLine
Console.WriteLine("Enter Student Email")
Email = Console.ReadLine
Console.WriteLine("Enter Student Address")
Address = Console.ReadLine
Console.WriteLine("Enter Student Tutor")
Tutor = Console.ReadLine

PrintLine(1, ID)
PrintLine(1, Email)
PrintLine(1, Address)
PrintLine(1, Tutor)

FileClose(1)
End Sub
Sub Main()
2.5?
FileOpen(1, "D:\cs pt 2.txt", OpenMode.Input)
FileOpen(2, "D:\cs new.txt", OpenMode.Output)
Dim ID, Email, LineString As String
Dim LengthString As Integer
Do
LineString = LineInput(1)
LengthString = Len(LineString)
ID = Left(LineString, 6)
Email = Right(LineString, LengthString - 7)

PrintLine(2, ID)
PrintLine(2, Email)

Loop Until EOF(1)


FileClose(1)
FileClose(2)
End Sub

You might also like