C++ cin returns 0 for integer no matter what the user inputs
        Posted  
        
            by 
                kevin dappah
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by kevin dappah
        
        
        
        Published on 2012-12-17T10:47:28Z
        Indexed on 
            2012/12/17
            11:03 UTC
        
        
        Read the original article
        Hit count: 247
        
c++
No matter the cin it continues to to output 0 for score. Why is that? I tried returning the "return 0;" but still no go :/
#include "stdafx.h"
#include <iostream>
using namespace std;
// Variables
int enemiesKilled;
const int KILLS = 150;
int score = enemiesKilled * KILLS; 
int main()
{
    cout << "How many enemies did you kill?" << endl;
    cin >> enemiesKilled;
    cout << "Your score: " << score << endl;
    return 0;
}
© Stack Overflow or respective owner