HELP HELP HELP

how can I run the function it keeps saying period(IO) not declared in this function



#include <iostream>
#include <math.h>

using namespace std;
static const float PI = (float)(2*acos(0.0));

float period(float length,float g)
{
return (float)(2*PI*sqrt(length/g));
}

void sort3(void)
{
int a, b, c;
cout << "Please enter three integer values for a, b, and c, \n"
<< "followed by the Enter key each time\n";
cout << "a = ";
cin >> a;
cout << "b = ";
cin >> b;
cout << "c = ";
cin >> c;
cout << "The three integers in ascending order are: ";
//the following nested if-else statements define the output for possible scenario values of a, b, and c
if(a<b)
if(b<c)
cout << a << b << c;
else if (a<c)
cout << a << c << b;
else
cout << c << a << b;
else if(a<c)
cout << b << a << c;
else if (b<c)
cout << b << c << a;
else
cout << c << b << a;
}
void triplets(void)
{
int a, b, c;
//the following for loops set the initial, boundary, and incremental conditions for each variable in the equation
for(int a=2; a<30; a++)
for(int b=2; b<30; b++)
for(int c=2; c<30; c++)
if((a*a + b*b) == (c*c))
cout << a << "^2 +" << b << "^2 = " << c << "^2\n";
}



int quadratic(int a, int b, int c, double &r1, double &r2)
{
if(pow(b,2)-4*a*c < 0)
{
cout << "Non real result"<<endl;
return -1;
}
else
{
r1= (-b + sqrt( pow(b,2) - 4*a*c)) /(2*a);

r2= (-b - sqrt(pow(b,2) - 4*a*c)) /(2*a);
return 1;
}
}

unsigned long trib( unsigned int n )
{
return ( ( n < 3 ) ? 1 : trib( n - 1 ) + trib( n - 2 ) + trib( n - 3 ) );
}
int main()
{
char letter; //Below begins the outputs to execute the functions

cout << "This program allows you to execute five functions.\n\n Options Menu:";
cout << "Enter 'A' to compute period.\n Enter 'B' to compute sort 3.\n Enter 'C' to compute triplets.\n Enter 'D' to compute a Quadratic Equation.\n Enter 'E' to compute unsigned long.\n";
cout << "Enter the letter from the options menu for your desired function: ";
cin >> letter;

letter = toupper (letter);

while (!cin.eof())
{
switch(letter)
{
case 'A': periodIO();
break;
case 'B': sort3IO();
break;
case 'C': tripletsIO();
break;
case 'D': quadraticEquationIO();
break;
case 'E': unsignedLongIO();
break;

}

cout << "";
cin >> letter;
letter = toupper (letter);
}

return 0;
}

it keeps saying period(IO) not declared in this function

Because you never declared it?

Your switch statement calls periodIO, sort3IO, tripletsIO, quadraticEquationIO and unsignedLongIO, but you have no such functions in your program.

PLEASE USE CODE TAGS (the <> formatting button) when posting code. It makes it easier to help you.
when your calling a return function you need to have a variable to return a value into so most importantly as AbsractionAnon said the functions you call in the switch statement don't exist. if you were trying to display the result of one of these functions use something like float display = period(); cout << display << "\n";
Topic archived. No new replies allowed.