bool IsSquare (int);so I am trying to use it & the
mySquareRootthat I found here, but I am doing something wrong. See error below...Suggestions??
You all are a great help! Thank you!
#include<iostream>
#include<cmath>
#include<string>
using namespace std;
//****function prototypes****************************************************
//1st -- this section describes the type/format of the functions
//return type: bool
//parameters: double
//purpose: this function determines whether a given number is a perfect square.
bool IsSquare (double num);
//2nd -- this section calls the function needed
int main()
{
//declare variables
double num;
double IsSquare;
double float mySquareRoot;
//call IsSquare function = bool IsSquare(double num);
//prompt for number
do
{
cout<<"Enter number to determine if it is a perfect square: \n";
cin>>num;
if (num >= 1)
{
mySquareRoot = sqrt(num);
cout<< "The square root is " <<mySquareRoot<<endl;
}
}while (num >= 1);
return 0;
}
//function declarations
//3rd -- this section performs the action
//return type: bool
//parameters: double
//purpose: this function determines whether a given number is a perfect square.
bool IsSquare (double num)
{
return mySquareRoot = sqrt(num);
}
Errors:
square.cpp: In function ‘bool IsSquare(double)’: square.cpp:62: error: ‘mySquareRoot’ was not declared in this scope

New Topic/Question
Reply



MultiQuote








|