#include <cstdlib>
#include <iostream>
#include <cmath>
usingnamespace std;
void biggest (double a, double b, double c);
int main ()
{
double a, b, c;
cout << "Enter in three values";
cin >> a >> b >> c ;
biggest(a,b,c);
system ("PAUSE");
return EXIT_SUCCESS;
}
void biggest (double a, double b, double c)
{
if (a > b && a > c)
{
cout << "The biggest number is" << " " << a;
}
else (b > c && b > a)
;cout << "The biggest number is" << " " << b;
else (c > a && c > b)
{
cout << "The biggest number is" << " " << c;
}
}
For some reason the last else statement will not compile.
The error comes up as:
expected `;' before "else"
So I put the semicolon and compile again, then it comes up with the same error, so I put a semicolon after both else statements and it will not compile. Please help !!
Notice line 26 begins with a semicolon? That looks like an attempted fix for the problem of the missing "if".
So remove that semicolon as well as adding the "if".
# include <cstdlib>
# include <iostream>
# include <cmath>
usingnamespace std;
void biggest (double a, double b, double c);
int main ()
{
double a, b, c;
cout << "Enter in three values" << endl;
cin >> a >> b >> c ;
biggest(a,b,c);
cin.ignore();
return EXIT_SUCCESS;
}
void biggest (double a, double b, double c)
{
if(a > b && a > c)
cout << "The biggest number is" << " " << a;
elseif(b > c && b > a)
cout << "The biggest number is" << " " << b;
else cout << "The biggest number is" << " " << c;
}
another also no one used Div cpp anymore use code::blocks