Hi!!!
I want to make a code for diving a number along with that i want that complete division steps should be shown in listbox.You can see the steps in image attached with my thread.......
Can anyone tell me how can i dynamically generate such steps of division of any number

Recommended Answers

All 6 Replies

A division is in essence a repeated substraction.
Write down how you would do a division with paper and pencil.
Try to translate that in code. The modulus % and the integer division / operators might help you out here.

I know the division.........
Problem is that is it possible to display division method as show in picture in the listbox.........
I want to show in listbox like in the given picture

Drop a Panel on your form and use the Paint event of the Panel.
Something like this:

private void outPanel_Paint(object sender, PaintEventArgs e)
        {
            // just to make the code somewhat shorter, (not needed)
            Graphics G = e.Graphics;
            // Create font and brush.
            Font drawFont = new Font("Arial", 14);
            SolidBrush drawBrush = new SolidBrush(Color.Blue);
            // Create point for upper-left corner of drawing.
            // remember upper left is 0,0
            float x = 15.0F;
            float y = 15.0F;
            // Now draw a string in blue 15,15 from the upperleft corner
           // of the panel in Ariel .14 font
            G.DrawString(MyNumberstring, drawFont, drawBrush, x , y);
            //More DrawString here
            //More drawing here G.DrawLine(... Ellipse what you want
        }
commented: I was wondering how the OP would go about it :) +8

What does "MyNumberstring" refers to in your code..........
And how to enter "a/b" so that it gives answer and the pattern in the panel...............

Actually , The way I have shown in the picture in the first thread.....In the same way I want to print for each division question........
So that for each question which I enter , the result should be displayed in such pattern giving complete explaination............

Just tell me is it possible to generate such patterns dyanamically or not.............

Well, I put in MyNumberstring just as a placeholder!
It's for you to decide what MyNumberstring contains. A dividend a divisor a quotient some other number? I don't know, you do.
You can place any such number in the panel on the position YOU want by manipulating the x and y coordinates of the DrawString method.
So to answer your question it is possible to do what you want dynamically.
You can even draw the lines like in your example, just as I mentioned in the last comment of my code snippet.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.