boris90's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Active Members
Active Posts:
62 (0.03 per day)
Joined:
15-November 09
Profile Views:
1,249
Last Active:
User is offline Apr 16 2013 03:32 AM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
0

Latest Visitors

Icon   boris90 is trapped in an infinite loop compiling code forever.

Posts I've Made

  1. In Topic: [C++] If condition is never true (but it should be)

    Posted 14 Feb 2013

    Yeah, I wrote this code and I know each part of it. The only problem being that it loops through each line of a text file and it doesn't stop for the line where fileUser and result2 are the same.
    How do I know that? Well, I already said that I tested it by printing it to a file (fileUser variable) and it outputted the first word of the last line. So this should already be a proof that it loops through all lines and assigns the fileUser variable, each loop, the first word of each line of the text file.

    Would you consider using the break or continue commands? I don't really think they'd help, but then again...
  2. In Topic: [C++] If condition is never true (but it should be)

    Posted 14 Feb 2013

    View PosttlhIn`toq, on 14 February 2013 - 07:11 PM, said:

    Quote

    the result2 == fileUser is never true! How come?

    013  if (result2 == fileUser)
    
    


    When you put a breakpoint on this line and look at the actual values of these two variables at run time, what are the values? Can you show us a screenshot of your IDE showing these values?

    My first guess is the cases don't match. fred.txt != FRED.txt


    OK, here's the screenshot.
    Posted Image
    Click on the image when you open the link for higher resolution and clarity.

    Anyway,notice that this may not be the final value of fileUser variable, because the 'if' condition is located inside the while loop, and so fileUser's value constantly changes each time it loops.
    I even once tested the value of fileUser by outputting it to a text file, and after a full execution of a program, it showed me the first word of the last line! The word USERNAME that you see is the first word of the first line, which is a header line. The second line contains boris90 as a first word and some other info, too.

    I think I know what's the problem, but I just need the opinion and a solution suggestion.
    I think it goes through each line and somehow extracts the first words, but it doesn't stop when it should show the message, but rather continues through every other line...

My Information

Member Title:
D.I.C Head
Age:
24 years old
Birthday:
November 8, 1990
Gender:
Location:
Belgrade, Serbia
Interests:
Video games, music composition, programming, TV
Full Name:
Boris Jakovljević
Years Programming:
4
Programming Languages:
Pascal, Java, C++, HTML, CSS

Contact Information

E-mail:
Click here to e-mail me
MSN:
MSN  boris90@gmail.com
Website URL:
Website URL  http://www.facebook.com/boris90
Yahoo:
Yahoo  boris90@rocketmail.com
Skype:
Skype  boris.jakovljevic.780
LinkedIn:
http://rs.linkedin.com/pub/boris-jakovljevi%C4%87/28/b02/b84
Facebook:
www.facebook.com/boris90
Twitter:
boky90
Xfire:
boris90

Friends

boris90 hasn't added any friends yet.

Comments

boris90 has no profile comments yet. Why not say hello?