Jump to content

idsuni

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by idsuni

  1. So i started programming a few days ago and wanted to do a little C++ program. Can anyone explain me why it prints 0 instead of 1? What do I need to change? Best regards.

    #include <iostream>
    
    using namespace std;
    
    int main ()
    {
        int i;
        i = 0;
    
        if (int i = 0)
        {
            i++;
        }
        else 
        {
    
        }
    
        cout << i << endl;
    
        return 0;
        
    }
×
×
  • Create New...