Results 1 to 17 of 17

Thread: little q: illogical logical more c++

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2010
    Posts
    20
    Thanks
    2
    Qt products
    Qt4

    Default little q: illogical logical more c++

    code below

    Qt Code:
    1. diff_1 = 0;
    2. if (diff_1 == 0.00) {cout<<"flag_1";}
    3. if (diff_1==1.00) {pennies = pennies + 1;
    4. cout<<"increment by a penny to "<<pennies<<endl;}
    To copy to clipboard, switch view to plain text mode 

    THis works a lot of the time but occasionally I'll run a number through the system and get bizzare output:

    put in for diff_1-->1.00 (that's all - no decision tress)

    sometimes 1.00 bypasses both conditions even though I manually set diff_1 to 1.00. and also fails to execute the decision tree next to it:
    Qt Code:
    1. if (diff_1==1.00) {pennies = pennies + 1;
    2. cout<<"increment by a penny to "<<pennies<<endl;}
    To copy to clipboard, switch view to plain text mode 
    Last edited by T1001; 29th June 2015 at 22:40.
    All Your Base Are Belong To Us

Similar Threads

  1. Suggestions for logical expression syntax?
    By rakkar in forum Qt Programming
    Replies: 1
    Last Post: 19th September 2009, 20:24
  2. Non logical Errors - qmake
    By ahmhdy in forum Qt Programming
    Replies: 7
    Last Post: 19th June 2009, 21:11
  3. Replies: 0
    Last Post: 24th November 2008, 08:52
  4. little logical question........
    By sudheer in forum Qt Tools
    Replies: 3
    Last Post: 8th May 2008, 14:15
  5. Logical fonts?
    By sdfisher in forum Qt Programming
    Replies: 1
    Last Post: 1st March 2007, 13:01

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.