Hack Forums
[C#] Captcha thingy - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C#] Captcha thingy (/showthread.php?tid=5270372)



Captcha thingy - hamburgerman - May 15, 2016

Made this in C#. Still learning. Made through a tutorial from Brackeys.

Code
using System

namespace NumberGenerator
    {

class Program
    {
    static void Main(string[] args)
        {
           Random numberGenerator = new Random();

           int num01 = randomNumberGenerator.Next(1,11);
           int num02 = randomNumberGenerator.Next(1,11);

           Console.WriteLine("What is " + num01 + " times " + num02 + "?");

           int answer = Convert.ToInt32(Console.ReadLine());

           if (answer == num01 * num02) {
               Console.WriteLine("Well done. Correct!");
           } else {
                    int responseIndex = numberGenerator.Next(1, 4);

                    switch (responseIndex)

                    Console.WriteLine("Wrong answer. Refresh the page and try again.");
           }

        }
    }
}

Thoughts? Will it work? It's something like the captcha when registering on HF.


* - CanadianBacon - May 15, 2016

congrats u made a program that will place a random number in the captcha. odds of this program getting the number right 0.01% or if more than 4 numbers required this is practically impossible.


* - MikaDev - May 15, 2016

(May 15, 2016 03:35 PM)Blacksniper Wrote:  congrats u made a program that will place a random number in the captcha. odds of this program getting the number right 0.01% or if more than 4 numbers required this is practically impossible.

By the time this succeeds he learned C# Java and 5 other languages. But yeah dude, for learning purposes, everything you make is progress towards learning, so hey, GJ OP! :)


* - iNCEPTiON_V - May 15, 2016

i need this for EuroMillion Lottery... Can i use this?


* - uint32 - May 15, 2016

Ayy lmao all the replies saying it's to solve the captcha, if you took some time and read the code you'd see that its to make text based catchas smh

btw op good job if it's one of your first things.


* - iNCEPTiON_V - May 15, 2016

(May 15, 2016 05:24 PM)Coefficient Wrote:  Ayy lmao all the replies saying it's to solve the captcha, if you took some time and read the code you'd see that its to make text based catchas smh

btw op good job if it's one of your first thing.

I know it was a joke lol.
didnt dislike his code ,for his first thing its great, my first code didnt even compare to his awful :)


* - Odus - May 16, 2016

(May 15, 2016 01:15 PM)hamburgerman Wrote:  
Code
         int responseIndex = numberGenerator.Next(1, 4);

                    switch (responseIndex)

What is the purpose of responseIndex and this switch declaration? Were you planning something for it?

Also you're mixing between new line and continued line braces.