Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. from int to double
Forum Update on Monday, May 27th 2025

from int to double

Scheduled Pinned Locked Moved Solved C++ Gurus
6 Posts 4 Posters 4.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    I would like to covert int b= 10 in 10.0, how must I do?

    J.HilkJ jsulmJ 2 Replies Last reply
    0
    • ? A Former User

      I would like to covert int b= 10 in 10.0, how must I do?

      J.HilkJ Online
      J.HilkJ Online
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @vale88
      int b = 10;
      double c = static_cast<double>(b);

      But I have a feeling, that's not what you actually want? Can you elaborate a bit more?


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      ? 1 Reply Last reply
      5
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        In addition to @J-Hilk:

        int a = 10;
        double b = double(a);
        double c(a);
        

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        2
        • ? A Former User

          I would like to covert int b= 10 in 10.0, how must I do?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @vale88 I suggest to ask pure C++ questions in this forum: https://forum.qt.io/category/34/c-gurus

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          SGaistS 1 Reply Last reply
          0
          • jsulmJ jsulm

            @vale88 I suggest to ask pure C++ questions in this forum: https://forum.qt.io/category/34/c-gurus

            SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @jsulm said in from int to double:

            @vale88 I suggest to ask pure C++ questions in this forum: https://forum.qt.io/category/34/c-gurus

            Good point, moved.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • J.HilkJ J.Hilk

              @vale88
              int b = 10;
              double c = static_cast<double>(b);

              But I have a feeling, that's not what you actually want? Can you elaborate a bit more?

              ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #6

              @J.Hilk thanks

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved