C. Design a calculator to determine whether the input is a number

Updated on technology 2024-06-09
17 answers
  1. Anonymous users2024-02-11

    Determine if it's a number.

    String. private bool isnumeric(string str)if (str == null ||== 0)return false;

    ascii = new ;

    byte bytestr = ;

    foreach(byte c in bytestr)if (c < 48 ||c > 57)

    return false;

    return true;

  2. Anonymous users2024-02-10

    public bool isnumericregex(string str)

    reg = new

    return ;

    Add a judgment to the button1 click event and you're good to go.

  3. Anonymous users2024-02-09

    if("Entered",out output int)) textbox += output.

    If you enter a number other than a number, it will return false

    It's as simple as that, it doesn't have to be that complicated.

  4. Anonymous users2024-02-08

    Create a stack, put strings in it, then take it out (pop), and use it in turn to determine whether it is a number or not, and if there is a non-match, you will know that it is not a number.

    The idea I said is so detailed, you just follow it, it's very simple. If you don't understand something, you can check MSDN, so that you can learn something, and it is not possible to have everything ready-made.

    Since you are a beginner, you should know that MSDN is a must-have, and almost all questions (which beginners don't understand) can find answers there.

  5. Anonymous users2024-02-07

    private void button1_click(object sender, eventargs e)

    Else you can see it.

  6. Anonymous users2024-02-06

    My personal recommendation is to use regular expressions to judge the best.

    The regular expression for judging real numbers is -d+d*$ specific method.

    1. Add a reference.

    using ;

    2、string regex = @"^-?d+\.d*$";

    bool result = character, regex);

    result: If the result is true, the character is a real number.

  7. Anonymous users2024-02-05

    Heh, regular expressions.

    Custom judgments.

    Spatial judgment. Write whatever you want.

  8. Anonymous users2024-02-04

    No need to write** VS2005 There is a control to determine whether it is a number comparevalidator should be this to set its properties.

  9. Anonymous users2024-02-03

    Write a method, and write this paragraph in the method**:

    public bool isnumber(string str)

    return true;

  10. Anonymous users2024-02-02

    Pull two textbox controls as numeric inputs; Pull a few button controls, click the controls to perform addition, subtraction, multiplication and division operations.

  11. Anonymous users2024-02-01

    Previously written, can meet the idea of lz da ze

  12. Anonymous users2024-01-31

    Static void main (string args) is a prime number. ", num);

    else is not a prime number. ", num);}

  13. Anonymous users2024-01-30

    label can only be assigned to it programmatically, not by the user.

  14. Anonymous users2024-01-29

    You can take out the string entered by the user one at a time, and then judge whether it belongs to 0-9, if not, it will prove that it is not a number, I just give the principle, **You can write it yourself.

  15. Anonymous users2024-01-28

    regularexpressionvalidator

    This control can be verified.

    Then write an expression and that's it.

  16. Anonymous users2024-01-27

    It can be directly bound to a backend property.

    Or enter the event with the keyboard.

  17. Anonymous users2024-01-26

    You can use regular expressions, too.

Related questions
10 answers2024-06-09

1. Set the startselection property of textbox1 (I forgot whether it was this or selectionstart, which is used to set the selection position of the return text attribute), set to. >>>More

6 answers2024-06-09

To give you an idea, you mainly want to get tired of the value of "what" text2 when you click the button, then you can reuse the value in the label, that is, but assuming that the value of text1 is assigned first, it will be the result when the point is more than once, so you need to add a flag variable to identify whether it has been calculated once......Others think about it, the idea is almost like this, but the form can be changeable, the key is that the function of your ** is written independently The versatility is not enough, and it is slightly more to change**.

12 answers2024-06-09

Assign three numeric variables to three text boxes.

Write in an instance of a clip on one of the Stage: >>>More

8 answers2024-06-09

1.Power-on on button: Press this key to power on, or clear all registers. >>>More

6 answers2024-06-09

1 all"Please enter the start year");

int x=; >>>More