| |

VerySource

 Forgot password?
 Register
Search
View: 754|Reply: 2

Please take a look at everybody! Minor question!

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-5 05:00:01
| Show all posts |Read mode
for (i = 0; i <11; i ++)
                    {for (j = 0; j <9; j ++)
                        {
                            printf (Caption, "% 03d", i + i * j);

                            btnCreateText (xmembutton, i + i * j, 0 + j * 40, 0 + i * 22,40,22,1,0,&fi8x16, Caption, 255, i + i * j, Caption, 0,0xE0);

                            btnDisplay (xmembutton, i + i * j);
                        }
                    }

I use two loops to display the array, btnCreateText is to create a button, and Caption is the value displayed on this button! I am puzzled by i + i * j. Some calculations are not correct! Essentially, the order of the values ​​of an array!
Reply

Use magic Report

0

Threads

63

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 China

Post time: 2020-3-23 19:00:01
| Show all posts
10 * i + j
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-3-24 01:00:02
| Show all posts
for (i = 0; i <11; i ++)
                    {for (j = 1; j <9; j ++)
                        {
                          sprintf ("% 03d", 10 * i + j);
                        }
                    }

Should this be the case?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list