Results 1 to 20 of 28

Thread: What is wrong with my code?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Posts
    68
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: What is wrong with my code?

    Excuse me but can someone answer my question
    Try to be useful for your society,not important.
    ------------------------------------------------------
    Every thing that has a beginning,Has an end.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: What is wrong with my code?

    What is the question?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2009
    Posts
    68
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: What is wrong with my code?

    Oh your right
    well how can i use sin,cos,tan and sqrt
    and how can i make the lineEdit to show numbers with more than 6 zeros(not user input)without using scientific notation and how can i make it to show floating pomt numbers with more than 5 digits after point(not user input) and one thing about user input the second quoted line in my two last post must make the lineEdit to accept just 10 integers after point but you can enter as many as you want.
    How can i correct problems above?
    Try to be useful for your society,not important.
    ------------------------------------------------------
    Every thing that has a beginning,Has an end.

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: What is wrong with my code?

    Quote Originally Posted by Dante View Post
    Oh your right
    well how can i use sin,cos,tan and sqrt
    just include "#include <math.h>".
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: What is wrong with my code?

    Quote Originally Posted by spirit View Post
    just include "#include <math.h>".
    Or better yet "#include <cmath>" and use the std namespace.

    About significant digits - remember floats have a limited precision. Use double instead of float wherever necessary. Scientific notation and "regular" notation has nothing to do with precision. If the precision is not what you wanted and you know the datatype can handle the required precision, it means you must have made a mistake while setting up the widget.
    Last edited by wysota; 5th April 2009 at 23:40.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Mar 2009
    Posts
    68
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: What is wrong with my code?

    I included <cmath> and entered the line:
    using namespace std
    but it still gives the same error
    and what you mean by making a mistake while setting up the widget?
    Try to be useful for your society,not important.
    ------------------------------------------------------
    Every thing that has a beginning,Has an end.

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: What is wrong with my code?

    Ok, but what is the error?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    Mar 2009
    Posts
    68
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: What is wrong with my code?

    The one in i mentioned in my fourth post.
    [address] ~ can not be used as a function
    Try to be useful for your society,not important.
    ------------------------------------------------------
    Every thing that has a beginning,Has an end.

  9. #9
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: What is wrong with my code?

    can you show us how you call this method? please, provide relevant code.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  10. #10
    Join Date
    Mar 2009
    Posts
    68
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: What is wrong with my code?

    with having :
    Qt Code:
    1. #include <QtGui>
    2. #include <cmath>
    3. #include "Calc++.h"
    4.  
    5. using namespace std;
    To copy to clipboard, switch view to plain text mode 
    at the top
    Qt Code:
    1. else if (operation.contains("sqrt"))
    2. if(m_op1<0){
    3. lineEdit->setAlignment(Qt::AlignLeft);
    4. lineEdit->setText("Sqrt accepts just positive numbers.");
    5. }
    6. else lineEdit->setText(QString::number(sqrt(m_op1)));
    7. else if (operation.contains("sin"))
    8. lineEdit->setText(QString::number(sin(m_op1)));
    9. else if (operation.contains("cos"))
    10. lineEdit->setText(QString::number(cos(m_op1)));
    11. else if (operation.contains("tan"))
    12. lineEdit->setText(QString::number(tan(m_op1)));
    To copy to clipboard, switch view to plain text mode 
    Try to be useful for your society,not important.
    ------------------------------------------------------
    Every thing that has a beginning,Has an end.

  11. #11
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: What is wrong with my code?

    I don't see any problem. it should work fine.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  12. #12
    Join Date
    Mar 2009
    Posts
    68
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: What is wrong with my code?

    So what should i do?
    Try to be useful for your society,not important.
    ------------------------------------------------------
    Every thing that has a beginning,Has an end.

Similar Threads

  1. copyright and gpl
    By janus in forum General Discussion
    Replies: 8
    Last Post: 21st October 2008, 01:13
  2. Qt 4.3.0 lots of Bugs!
    By VireX in forum Qt Programming
    Replies: 69
    Last Post: 20th June 2007, 22:05
  3. Pasting code from code tag in emacs
    By Gopala Krishna in forum General Discussion
    Replies: 0
    Last Post: 16th February 2007, 05:47
  4. Qt Cryptographic Architecture
    By vermarajeev in forum Qt Programming
    Replies: 6
    Last Post: 9th February 2007, 13:15

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.