I am trying to get the smallest and biggest number out of three numbers using if statements. My problem is that I keep getting an error that says I did not initialize the variables...
Error C4700 uninitialized local variable 'b' used
Error C4700 uninitialized local variable 'c' used
#include <iostream>
usingnamespace std;
int main()
{
double a, b, c;
cout << "Please enter three numbers \n";
cin >> a, b, c;
if ((a > b) && (a > c))
{
cout << a << " is the largest \n";
if (b > c)
{
cout << c << " is the smallest";
}
if (c > b)
{
cout << b << " is the smallest";
}
}
if ((b > c) && (b > a))
{
cout << b << " is the largest \n";
if (a > c)
{
cout << c << " is the smallest";
}
if (c > a)
{
cout << a << " is the smallest";
}
}
if ((c > b) && (c > a))
{
cout << c << " is the largest \n";
if (b > a)
{
cout << a << " is the smallest";
}
if (a > b)
{
cout << b << " is the smallest";
}
}
return 0;
}