Click here to Skip to main content
15,394,635 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: File IO library Pin
Richard MacCutchan26-Jun-22 4:49
mveRichard MacCutchan26-Jun-22 4:49 
Questionhello guy my name is SARORN can i ask you about any inform? Pin
Sa Ron 202224-Jun-22 5:40
MemberSa Ron 202224-Jun-22 5:40 
AnswerRe: hello guy my name is SARORN can i ask you about any inform? Pin
Victor Nijegorodov24-Jun-22 5:51
MemberVictor Nijegorodov24-Jun-22 5:51 
AnswerRe: hello guy my name is SARORN can i ask you about any inform? Pin
k505424-Jun-22 6:27
mvek505424-Jun-22 6:27 
AnswerRe: hello guy my name is SARORN can i ask you about any inform? Pin
RedDk24-Jun-22 8:42
MemberRedDk24-Jun-22 8:42 
Questionc++ Pin
tuanguyen200021-Jun-22 22:59
Membertuanguyen200021-Jun-22 22:59 
QuestionRe: c++ Pin
CPallini22-Jun-22 0:02
mveCPallini22-Jun-22 0:02 
Questionc++ Pin
tuanguyen200021-Jun-22 6:49
Membertuanguyen200021-Jun-22 6:49 
#include <iostream>
using namespace std;

bool checkSquareNumber(int num)
{
    int i=0;
    while(i*i <= num)
    {
        if(i*i==num)
            return true;
        i++;
    }
    return false;
}
int squareNumber(int num)
{
    int i=0;
    while(i*i <= num)
    {
        if(i*i==num)
            return i;
        i++;
    }
    return i;
}
int numberOfStep(int num)
{
    int cnt =0;
    int i =0;
    while(num)
    {
        if(checkSquareNumber(num)== true)
            {
                num = squareNumber(num);
                cnt++;
            }
        else if(num%3==0)
        {  
            num = num/3;
            cnt++;
        }
        else if(num%2==0) 
        {   
            num/=2;
            cnt++;
        }
        else  
        {
            num--;
            cnt++;
        }
    }
    return cnt;
}
int main()
{
    int num,t;
    cin>>t;
    while(t--)
    {
        cin>>num; 
        cout<<numberOfStep(num)<<endl;
    }
    return 0;
}

AnswerRe: c++ Pin
tuanguyen200021-Jun-22 6:50
Membertuanguyen200021-Jun-22 6:50 
GeneralRe: c++ Pin
James Curran21-Jun-22 7:29
MemberJames Curran21-Jun-22 7:29 
GeneralRe: c++ Pin
tuanguyen200021-Jun-22 14:53
Membertuanguyen200021-Jun-22 14:53 
GeneralRe: c++ Pin
CPallini21-Jun-22 20:20
mveCPallini21-Jun-22 20:20 
GeneralRe: c++ Pin
tuanguyen200021-Jun-22 22:50
Membertuanguyen200021-Jun-22 22:50 
GeneralRe: c++ Pin
tuanguyen200021-Jun-22 22:51
Membertuanguyen200021-Jun-22 22:51 
GeneralRe: c++ Pin
CPallini21-Jun-22 23:08
mveCPallini21-Jun-22 23:08 
GeneralRe: c++ Pin
Richard MacCutchan22-Jun-22 1:20
mveRichard MacCutchan22-Jun-22 1:20 
Questionparsing interactive text Pin
Member 1496877116-Jun-22 5:53
MemberMember 1496877116-Jun-22 5:53 
AnswerRe: parsing interactive text Pin
Mircea Neacsu16-Jun-22 8:09
mvaMircea Neacsu16-Jun-22 8:09 
AnswerRe: parsing interactive text Pin
trønderen16-Jun-22 10:52
Membertrønderen16-Jun-22 10:52 
JokeRe: parsing interactive text Pin
Peter_in_278016-Jun-22 11:56
professionalPeter_in_278016-Jun-22 11:56 
GeneralRe: parsing interactive text Pin
Member 1496877116-Jun-22 18:29
MemberMember 1496877116-Jun-22 18:29 
AnswerRe: parsing interactive text Pin
Richard MacCutchan18-Jun-22 2:50
mveRichard MacCutchan18-Jun-22 2:50 
QuestionCan importing C++ DLL files in a C# project has a positive effect on the overall performance of the application? Pin
Code4Ever10-Jun-22 8:39
MemberCode4Ever10-Jun-22 8:39 
AnswerRe: Can importing C++ DLL files in a C# project has a positive effect on the overall performance of the application? Pin
Dave Kreskowiak10-Jun-22 9:56
mveDave Kreskowiak10-Jun-22 9:56 
QuestionLoading DLL from file not PATH Pin
Valentinor8-Jun-22 22:59
MemberValentinor8-Jun-22 22:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.