can I get some feedback on why this IF statement is failing me?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jopeters
    New Member
    • Oct 2010
    • 5

    #1

    can I get some feedback on why this IF statement is failing me?

    I cant seem to find the problem in this code...

    Code:
    ifstream fin;
    	fin.open("C:/Users/Josh/Desktop/TriNode/NumList.txt");
    
    	int first;
    	fin >> first;
    
    	cout << first;
    
    	if(first < 10)
    	{
    		trinode root(first);
    		list<int>::iterator currentIt;
    
    		while(!fin.eof())
    		{
    			int temp;
    			fin >> temp;
    			root.insert_node(temp);
    		}
    	}
    when I try to use the trinode "root" or the iterator "currentIt" after this if statement, it keeps giving me errors saying they are not declared, which I would assume means it never gets past the IF(first <10) but If i cout << first right before, its 8.....which is obviously less than 10. If i remove the if statement it will work..but i NEED that statement for later code.
  • jopeters
    New Member
    • Oct 2010
    • 5

    #2
    I just commented out the inside of the IF and replaced it with a cout << "This works"; and for some reason THAT will work, but it wont work when I use the code above...

    Comment

    • jopeters
      New Member
      • Oct 2010
      • 5

      #3
      alright that was a stupid mistake...never mind

      Comment

      Working...