C++ beginner here. So, I'm trying to make this code function like a finals grade calculator, but it isn't working. It gives back the value of 100 every time. What's wrong?
#include <iostream>
using namespace std;
int main()
{
double grade, des, worth, per, grade1, tgrade, fgrade;
cout<<"What is your current grade in the class?"<<endl;
cin>>grade;
cout<<"What is your desired grade in the class?"<<endl;
cin>>des;
cout<<"How much is your final exam worth? (Percent of total grade)"<<endl;
cin>>worth;
per=1-(worth/100);
grade1=grade*per;
fgrade=100;
while ((tgrade-0.01)<=des<=(tgrade+0.01)) {
fgrade=fgrade-1;
tgrade=grade1+(fgrade*(worth/100));
}
cout<<"You need a grade of "<<fgrade<<"% on your final exam to reach your desired grade in your class. Good Luck!"<<endl;
return 0;
}