Why does my code not read or follow the if statements?
#include<iostream>
using namespace std;
int main (){
    
    int sum = 0;
    int integer;
    
    while ((integer != -1) && (sum < 2000)){
        int integer;
        
        cout<<"Enter an integer: ";
        cin>>integer;
        if (integer == -1){
            cout<<"Program was terminated.\n"<<"Your total sales are: "<<sum<<endl;
            break;
        }
        else if (sum >= 2000) {
            cout<<"Congratulations!"<<"Your total sales are: "<<sum<<endl;
            break;
        }
        
        sum = sum + integer;
        if (sum > 499){
            cout<<"You're off to a good start!"<<endl;
        }
        if (sum > 999){
            cout<<"You're halfway through!"<<endl;
        }
        else if (sum > 1499){
            cout<<"You're almost there!"<<endl;
        }
    }
    return 0;
}
Expected: Input looks like: Enter an interger: 350, 500,800, 500
Then the out should look like:
Enter an integer 350
      " "        500
                 youre off to a good start
                 800
                 youre halfway through
                 500
                 Congratualations! Youre total sales are: 2150
Reality:
Enter an integer: 350
Enter an integer: 500
You're off to a good start!
Enter an integer: 800
You're off to a good start!
You're halfway through!
Enter an integer: 500
You're off to a good start!
You're halfway through!
 
     
    