prime numbers c#

前端 未结 8 1672

I\'m new to C#. And I would like to program something like, displaying the prime numbers in a listbox if user will input any integer in the textbox. (that means, if they wri

8条回答
  •  有刺的猬
    2020-12-11 18:50

    Well, first of all I'd think about how to find prime numbers, and write that in a console app that reads a line, does the math, and writes the results (purely because that is the simplest thing you can do, and covers the same parsing etc logic you'll need later).

    When you are happy with the prime number generation, then look at how to do winforms - how to put a listbox, textbox and button on a form; how to handle the click event (of the button), and how to read from the textbox and write values into the listbox. Your prime code should be fairly OK to take "as is"...

    If you don't already have an IDE, then note that C# Express is free and will cover all of the above.

提交回复
热议问题