Alright does anyone know what I should do from here? I have no idea if this is right...I keep getting this error when I try to compile it.
Code:
Undefined first referenced
symbol in file
displaySqRoot(int) /var/tmp//ccPzasRe.o
displayData(float) /var/tmp//ccPzasRe.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
Code:
#include <iomanip>
#include <iostream>
#include <cmath>
using namespace std;
//Function prototypes.
int userPrompt();
void displayHeadings();
void displayData(float x);
void displaySqRoot(int x);
//Main function.
int main()
{
int user_int;
user_int=userPrompt();
displayHeadings();
displayData(user_int);
displaySqRoot(user_int);
return 0;
}
//Function definitions.
//Get number from user.
int userPrompt()
{
int value;
cout << "Please enter a number: ";
cin >> value;
return value;
}
//Display headings.
void displayHeadings()
{
cout << endl << "\tNumber\tDiv by 2\tDiv by 3\tDiv by 5\tSquare\tSqRoot\tPrime" <<endl;
}
//Display data.
void displayData(int value)
{
cout << "\t" << value << "\t";
if((value%2) == 0.0) cout << "Yes\t\t";
else cout << "No\t\t";
if((value%3) == 0.0) cout << "Yes\t\t";
else cout << "No\t\t";
if((value%5) == 0.0) cout << "Yes\t\t";
else cout << "No\t\t";
}
//Display square root.
void displaySqRoot(float value)
{
cout << value*value << "\t";
if(value>=0.0) cout << setprecision(3) << sqrt(value) << endl;
else cout << "ERROR" << endl;
}