+ 1

I need help with some basics please

Can someone help me please? I am trying to write a very simple program that calculates the fluid requirements for a surgical patient. The formula is as follows. Give 4mL/kg for the first 10kg of weight. Give 2mL/kg for the second 10kg of weight. Give 1mL/kg for every additional kg over the first 20. Here is my code: Feel free to email me at Carmail0087@gmail.com if you are willing. #include <iostream> using namespace std; int main() { int weight=0; int sum=0,val=0,a=0,b=0,c=0,maintain=0;     cout << "Calculation of Maintenance Fluids!\n";     cout<< "Following the 4:2:1 Rule\n\n";     cout<< "Please enter the patient's weight: " << endl;     cin>>weight;     while (cin>>weight){     cout<<"You entered:"<<weight;   while(sum<weight)          {sum+=1;     while(sum=10){          a=sum*4;     }     while(sum=20){         b=sum*2;     }     while(sum>20){           c=weight-20;     }         }         maintain=a+b+c;     cout<<"The maintenance rate is: "<<maintain; }     }     return 0; } This is all I get when I run this code. It asks me for a weight. I enter a weight and press enter. NOTHING happens. If I then enter a second weight and press enter it says "You entered" and then repeats the weight I entered twice. If I enter 40 press enter and then enter 50 it says "you entered:5050

20th May 2017, 3:53 AM
Bryan
1 Antwort
+ 1
There is a lot happenning inside that code. You need to paste it into the playground. Then insert it into this thread. This is a start. enter on wieght per line 50 line 1 other wieght line 2
20th May 2017, 4:29 AM
Manual
Manual - avatar