Feb 28, 2016 at 11:46am UTC
this is what i have so far can someone please correct me where im wrong
#include <iostream>
using namespace std;
int main()
{
char HorseType;
int weight;
cout << "What type of horse do you have ?" << endl;
cout << "Enter 1 (Light Riding Horse), 2 (Large Riding Horse), 3 (Draft Horse)"
<< endl;
cin >> HorseType;
cout << "Now enter the horse's weight" << endl;
cin >> weight;
if (HorseType = 1 && weight >= 840 <= 1200)
{
cout << "WeightCategory: Optium" << endl;
cout << "Feed 3.0 pounds" << endl;
}
else if
{
(HorseType = 1 && weight > 1200)
cout << "Weight Category: Overweight" << endl;
cout << "Feed 2.5 pounds" << endl;
}
else
{
if (HorseType = 1 && weight < 840)
cout << "Weight Category: Underweight" << endl;
cout << "Feed 3.3 pounds" << endl;
}
if (HorseType = 2 && weight >= 1100 <= 1300)
{
cout << "Weight Category: Optium" << endl;
cout << "Feed 3.0 pounds" << endl;
}
else if
{
(HorseType = 2 && weight < 1100)
cout << "Weight Category: Underweight" << endl;
cout << "Feed 3.3 pounds" << endl;
}
else
{
if (HorseType = 2 && weight > 1300)
cout << "Weight Category: Overweight" << endl;
cout << "Feed 2.5 pounds" << endl;
}
if (HorseType = 3 && weight >= 1500 <= 2200)
{
cout << "Weight Category: Optium" << endl;
cout << "Feed 3.0 pounds" << endl;
}
else if
{
(HorseType = 3 && weight < 1500)
cout << "Weight Category: Underweight" << endl;
cout << "Feed 3.3 pounds" << endl;
}
else
{
if (HorseType = 3 && weight > 2200)
cout << "Weight Category: Overweight" << endl;
cout << "Feed 2.5 pounds" << endl;
}
system("pause");
return (0);
}
Last edited on Feb 28, 2016 at 11:47am UTC
Feb 28, 2016 at 12:16pm UTC
The confusion seems to be over the =
and ==
operators.
=
is used to assign a value
==
is used to test for equality
example here the = should be ==
if (HorseType = 1 && weight >= 840 <= 1200)
There should also be another &&
if (HorseType == 1 && weight >= 840 && weight <= 1200)
Last edited on Feb 28, 2016 at 12:19pm UTC