15,992,250 members
Home / Discussions / C / C++ / MFC

C / C++ / MFC

 Re: hello guy my name is SARORN can i ask you about any inform? Victor Nijegorodov24-Jun-22 5:51 Victor Nijegorodov 24-Jun-22 5:51
 Re: hello guy my name is SARORN can i ask you about any inform? k505424-Jun-22 6:27 k5054 24-Jun-22 6:27
 Re: hello guy my name is SARORN can i ask you about any inform? RedDk24-Jun-22 8:42 RedDk 24-Jun-22 8:42
 c++ tuanguyen200021-Jun-22 22:59 tuanguyen2000 21-Jun-22 22:59
 Re: c++ CPallini22-Jun-22 0:02 CPallini 22-Jun-22 0:02
 c++ tuanguyen200021-Jun-22 6:49 tuanguyen2000 21-Jun-22 6:49
 Re: c++ tuanguyen200021-Jun-22 6:50 tuanguyen2000 21-Jun-22 6:50
 Re: c++ James Curran21-Jun-22 7:29 James Curran 21-Jun-22 7:29
 Ok, so it appears the rules of this game are: - If a number is a perfect square, take its square root - if a number is divisible by 3, divide it by 3 - if a number is divisible by 2, divide it by 2 - otherwise, subtract 1. So, given an input of 32, we'd go 32 -> 16 -> 4 -> 2 -> 1 -> 0 for 5 steps. and given 75, we'd go 75 -> 25 -> 5 -> 4 -> 2 -> 1 -> 0 for 6 steps. Now, what problem are you having? A quick glance over the code didn't show any obvious errors. Your checkSquareNumber() and squareNumber() functions are quite inefficient. You'd be better off googling a better square root algorithm (or just using the library sqrt() function). Ad since they are doing the same thing, they could be combined (return -1 if it is not a perfect square, and you can replace the two calls with one) Truth, James
 Re: c++ tuanguyen200021-Jun-22 14:53 tuanguyen2000 21-Jun-22 14:53
 Re: c++ CPallini21-Jun-22 20:20 CPallini 21-Jun-22 20:20
 Re: c++ tuanguyen200021-Jun-22 22:50 tuanguyen2000 21-Jun-22 22:50
 Re: c++ tuanguyen200021-Jun-22 22:51 tuanguyen2000 21-Jun-22 22:51
 Re: c++ CPallini21-Jun-22 23:08 CPallini 21-Jun-22 23:08
 Re: c++ Richard MacCutchan22-Jun-22 1:20 Richard MacCutchan 22-Jun-22 1:20
 Message Closed 16-Jun-22 5:53 Member 14968771 16-Jun-22 5:53
 Re: parsing interactive text Mircea Neacsu16-Jun-22 8:09 Mircea Neacsu 16-Jun-22 8:09
 Re: parsing interactive text trønderen16-Jun-22 10:52 trønderen 16-Jun-22 10:52
 Re: parsing interactive text Peter_in_278016-Jun-22 11:56 Peter_in_2780 16-Jun-22 11:56
 Re: parsing interactive text Richard MacCutchan18-Jun-22 2:50 Richard MacCutchan 18-Jun-22 2:50
 Can importing C++ DLL files in a C# project has a positive effect on the overall performance of the application? Code4Ever10-Jun-22 8:39 Code4Ever 10-Jun-22 8:39
 Re: Can importing C++ DLL files in a C# project has a positive effect on the overall performance of the application? Dave Kreskowiak10-Jun-22 9:56 Dave Kreskowiak 10-Jun-22 9:56