1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

I'm new here :)C++&Java learning

Discussion in 'Meet and Greet' started by szoki, Mar 22, 2011.

  1. szoki

    szoki New Member

    Joined:
    Mar 22, 2011
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    "Helo world"(like my first program in C++ same in java)...
    My name is Zoran, from Macedonia.
    Hi to all...:seeya:
    Поздрав на сите...:seeya:
    Привет всем...:seeya:
    Hallo an alle...:seeya:
    Salut à tous...:seeya:
    Ciao a tutti...
    :seeya:
     
  2. NewsBot

    NewsBot New Member

    Joined:
    Dec 2, 2008
    Messages:
    1,267
    Likes Received:
    1
    Trophy Points:
    0
    HI and welcome to the forum and what languages did you post Hello world.
     
  3. szoki

    szoki New Member

    Joined:
    Mar 22, 2011
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Hi to all... English
    Поздрав на сите... Macedonian my natural..
    Привет всем... Russian
    Hallo an alle... German
    Salut à tous... French
    Ciao a tutti... Italian
     
  4. NewsBot

    NewsBot New Member

    Joined:
    Dec 2, 2008
    Messages:
    1,267
    Likes Received:
    1
    Trophy Points:
    0
    Great to see you have named the languages now.
     
  5. szoki

    szoki New Member

    Joined:
    Mar 22, 2011
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Code:
    #include <iostream>
    using namespace std;
    void main()
    {
       long int n;
       n=0;
       float x,y;
     do
      {
           n++;
           x=1+1/(float)n;
           y=1-1/(float)n;
       }while (x!=y);
              cout<<n<<" "<<x<<" "<<y;
    }
    This is the code with mistake in arithmetic precision.
    What's wrong with the code?
    And if i put the "cout" line before while, program doesn't stop.Why?
    When x & y will be same,or do they ever will be same?
    Can any1 answer my questions?

    Thanks in advance.
     

Share This Page