Results 1 to 4 of 4

Thread: add two integers

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2012
    Posts
    3
    Qt products
    Qt3
    Platforms
    Windows
    Thanks
    1

    Default add two integers

    how to add to integers,what is the easiest way to do it?

    ui->label2->setText(ui->plainTextEdit->toPlainText());
    int A,B,C;
    QString S1(ui->label->selectedText());
    QString S2(ui->label->selectedText());
    A = S1.toInt();
    B = S2.toInt();
    C = static_cast<int>(A)+ B; //need to add A + B but it gives 0 to me
    Last edited by Gishan; 8th September 2012 at 08:22.

Similar Threads

  1. Save 4 Integers in a QByteArray without memcpy
    By GonzoFist in forum Newbie
    Replies: 3
    Last Post: 18th May 2010, 00:15
  2. initialize QStringList with integers
    By tommy in forum Newbie
    Replies: 3
    Last Post: 13th May 2009, 07:48
  3. Only integers from QFontMetricsF width
    By StevenB in forum Qt Programming
    Replies: 3
    Last Post: 16th May 2008, 22:59
  4. how to get integers from mysql
    By eleanor in forum Qt Programming
    Replies: 9
    Last Post: 8th November 2007, 17:25
  5. Strings from LineEdit to Integers
    By Misko in forum Newbie
    Replies: 3
    Last Post: 12th August 2007, 12:11

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.