Sinisterly
[VB.Net] Programming exercises - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Visual Basic & .NET Framework (https://sinister.ly/Forum-Visual-Basic-NET-Framework)
+--- Thread: [VB.Net] Programming exercises (/Thread-VB-Net-Programming-exercises)

Pages: 1 2 3 4


[VB.Net] Programming exercises - Coder-san - 04-21-2011

Since I've came across many people who say they know VB.Net here, how about a contest? :p

What you have to do is solve the challenge with an optimized code.

Things to keep in mind.
  • Lesser words
  • No Try Catch ( instead of hiding errors, eliminate them).
  • I'm not being nazi about optimization here, so no microsecond optimization is required. A smaller code is given preference.
  • Code should only be in VB.Net

Winner will get 2 reps, and the license to brag about it for a day. Biggrin
I will decide when a challenge is over.
You cannot edit your Post, or submit a code again.
The one with the most optimized (and accurate) code will be the winner.



Challenge #1

Output required:

Code:
One 1 Two 2 Three 3 Four 4 Five 5 Six 6 Seven 7 Eight 8 Nine 9 Ten 10

Hint:
  • There are 10 spaces in between words and numbers.
  • There is no CrLf in the end.



RE: [VB.Net] Optimization Challenge - lil-wayneee - 04-22-2011

I love sucha contests but problem is i suck in english i didint undrestand all what you wanted us to make Tongue


RE: [VB.Net] Optimization Challenge - 1234hotmaster - 04-22-2011

nice contest but i don't really get what should we do... program it in command-line? use line breakers without CrLf?


RE: [VB.Net] Optimization Challenge - Coder-san - 04-22-2011

Just show the output. Commandline or in textbox.


RE: [VB.Net] Optimization Challenge - 1234hotmaster - 04-30-2011

ok lets give it a try Biggrin


Code:
Public Class Form1 Sub Main() dim i as byte Console.writeline("One {0}, i.tostring) i +=1 Console.writeline("Two {0}, i.tostring) i +=1 Console.writeline("Three {0}, i.tostring) i +=1 Console.writeline("Four {0}, i.tostring) i +=1 Console.writeline("Five {0}, i.tostring) i +=1 Console.writeline("Six {0}, i.tostring) i +=1 Console.writeline("Seven {0}, i.tostring) i +=1 Console.writeline("Eight {0}, i.tostring) i +=1 Console.writeline("Nine {0}, i.tostring) i +=1 Console.writeline("Ten {0}, i.tostring) i +=1 End Sub

well im 80% sure its wrong just testing Biggrin


RE: [VB.Net] Optimization Challenge - Coder-san - 04-30-2011

At least somebody tried. Smile

There is no End Class here, and the sub Main is never called, but I'll still let this one pass.

I'll wait for at least 1 more entry before announcing the result.


RE: [VB.Net] Optimization Challenge - Coder-san - 05-01-2011

ok well, it's been there for enough time now. Time to spoil.
I'd love to announce hotmaster, the only contestent the winner but he was too far from the solution.

Yes, I wanted people to use a simple String Array. :p

Spoiler: Solution
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ArrItems As String() = {"One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten"} For intI As Integer = 0 To 9 TextBox1.AppendText(ArrItems(intI) & Space(10) & (intI + 1) & If(intI = 9, "", vbCrLf)) Next End Sub



RE: [VB.Net] Optimization Challenge - 1234hotmaster - 05-01-2011

oh damn... the only weakness i have besides CodeDom, Arrays >_<

i couldn't even think of it that way... such a easy way... X_X

kk give second one im excited Biggrin


RE: [VB.Net] Optimization Challenge - Coder-san - 05-01-2011

Challenge #2

Here is some output (RHS) using an algorithm on alphabets (LHS):
You have to make a function using the algorithm and display the RHS as output.

Code:
ABC = 70 BRZ = 110



RE: [VB.Net] Optimization Challenge - 1llusion - 05-01-2011

time to install studio again I guess O.o