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);
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;
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";