User Profile

Collapse

Profile Sidebar

Collapse
thando7
thando7
Last Activity: Apr 17 '07, 10:20 AM
Joined: Apr 10 '07
Location: Cape Town South Africa
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • thando7
    started a topic C++ Boolean
    in C

    C++ Boolean

    so youre saying that the function must return true only if the number entered
    matches any of the below(its a perfect square), or it's not a perfect square.
    Thank you very much for the enligtenment i will try it out

    square 1 = 1
    square 2 = 4
    square 3 = 9
    square 4 = 16
    square 5 = 25
    square 6 = 36
    square 7 = 49
    square 8 = 64
    square 9 = 81
    square 10 = 100...
    See more | Go to post

  • thando7
    replied to C++ bool function
    in C
    Code:
    bool IsSquare(int Num)
    {
    	bool Flag = true;
    	for (int I = 2; I < (sqrt(I) / 2); I++)
    		if ((Num % I) == 0)
    		{
    			Flag = false;
    			break;
    		}
    	return Flag;
    }

    i have tried something of this sort, but the only problem is that
    the square root function is a type double and what confuses me is how to find
    out whether a number is a square root...
    See more | Go to post

    Leave a comment:


  • thando7
    started a topic C++ bool function
    in C

    C++ bool function

    i am a nb on this portal and i require assistance with the foll:
    I have to write a C++ boolean function, that determines whether an integer parameter is a square or not, and returns the answer to main( ).

    could you plz assist me with that. I have tried using the square root function but it does not seem to work

    --------------------------------------------------------------------------------
    See more | Go to post
No activity results to display
Show More
Working...