here is my program:
#include <iostream>
using namespace std;
int main(){
int num;
int numtotal = 0;
int numcount = 0;
int big = 0;
int low = 0;
cout<<"enter number or 0 to exit"<<endl;
cin>>num;
while(num != 0){
numtotal = numtotal + num;
numcount++;
big = num;
low = num;
cout<<"enter number or 0 to extit"<<endl;
cin>>num;
if(num < low){
low = num;
}
else if(num > big){
big = num;
}
}
cout<<"total of numbers: "<<numtotal<<endl;
cout<<"totoal of numbers entered: "<<numcount<<endl;
cout<<"biggest number: "<<big<<endl;
cout<<"lowest number: "<<low<<endl;
}
the "low" and "big" outputs are always the last 2 numbers the user inputs, for example:
( 5, 4, 3, 2)
biggest number: 2
lowest number: 0
what am I doing wrong here? thank you