473,383 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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

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

Expand|Select|Wrap|Line Numbers
  1. ifstream fin;
  2.     fin.open("C:/Users/Josh/Desktop/TriNode/NumList.txt");
  3.  
  4.     int first;
  5.     fin >> first;
  6.  
  7.     cout << first;
  8.  
  9.     if(first < 10)
  10.     {
  11.         trinode root(first);
  12.         list<int>::iterator currentIt;
  13.  
  14.         while(!fin.eof())
  15.         {
  16.             int temp;
  17.             fin >> temp;
  18.             root.insert_node(temp);
  19.         }
  20.     }
  21.  
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.
Oct 27 '10 #1
2 1351
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...
Oct 27 '10 #2
alright that was a stupid mistake...nevermind
Oct 27 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

28
by: Fábio Mendes | last post by:
I'm sorry if it's an replicate. Either my e-mail program is messing with things or the python-list sent my msg to /dev/null. I couldn't find anything related in previous PEP's, so here it goes a...
0
by: William Ryan | last post by:
I hate using Dynamic SQL and was prohibited from doing so b/c we couldn't use 'IN' Statement in the where clause with Parameters which broke out data access block. I wrote a work around which...
0
by: starace | last post by:
I have designed a form that has 5 different list boxes where the selections within each are used as criteria in building a dynamic query. Some boxes are set for multiple selections but these list...
2
by: terpatwork | last post by:
Hi, (1) I have an access form that allows users to enter data, and when they click a button, the OnClick code that I've written uses a SQL INSERT statement to insert the data into the database. I...
15
by: Nerox | last post by:
Hi, If i write: #include <stdio.h> int foo(int); int main(void){ int a = 3; foo(a); }
18
by: Scott David Daniels | last post by:
There has been a bit of discussion about a way of providing test cases in a test suite that _should_ work but don't. One of the rules has been the test suite should be runnable and silent at every...
1
by: BizWorld | last post by:
I am using .NET 2.0 new classed for FTP download purpose. I have requirement to connect with 3 different FTP and download all files list and see if file exist at my end. if not then i need to...
2
by: GarryJones | last post by:
(I am sorry if this is the wrong group for this posting, I cant find a group on usenet for phpmyadmin, but maybe someone would be nice enough to answer me anyway....) I need to import data into...
6
by: knellim | last post by:
Hello All, I am using PHP to connect to derby/db2 database. I want to implement unix_timestamp() function (used in mysql) to its equivalent in derby database. I found the equivalent as select {fn...
1
by: Jonah Portas | last post by:
I cant seem to find the problem in this code... ifstream fin; fin.open("C:/Users/Josh/Desktop/TriNode/NumList.txt"); int first; fin >> first; cout << first;
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.