CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Mar 2011
    Location
    Delhi India
    Posts
    110

    Question does adding 1 in my code doesn't make any change??

    Code:
    #include<iostream>
    using namespace std;
    int main()
    {
        using namespace std;
        float a=2e+6;
        cout<<a<<endl;
        float b=a+1;
        cout<<b<<endl;
        cout<<b-a<<endl;
        return 0;
    }
    output is a shown in attachment..
    if b and a are same then why their subtraction gives 1??
    however i have assigned b=a+1.. if it is so then why both are shown same??
    Attached Images Attached Images

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured