To programmers!!

Discussion in 'Computer Information' started by Hoogan $$$, Jun 22, 2006.

  1. Hoogan $$$

    Hoogan $$$ Guest

    I designed a program (C++),using "if & else" to my brother (child) as a game
    to guess any number and see if matches with magic number or not. The program
    is working good.
    But I don't know how can I copy it on floppy for example to give it to him
    to let him run on his computer. The program is found and operated by the
    original C++ program and its name file " guesse.cpp". The original C++ is a
    teaching program (teach your self)
    Please can I find help.
    Thank you all.
    Hoogan $$$, Jun 22, 2006
    #1
    1. Advertising

  2. Hoogan $$$

    Duane Arnold Guest

    Hoogan $$$ wrote:
    > I designed a program (C++),using "if & else" to my brother (child) as a game
    > to guess any number and see if matches with magic number or not. The program
    > is working good.
    > But I don't know how can I copy it on floppy for example to give it to him
    > to let him run on his computer. The program is found and operated by the
    > original C++ program and its name file " guesse.cpp". The original C++ is a
    > teaching program (teach your self)
    > Please can I find help.
    > Thank you all.
    >
    >
    >


    You find yourself a compiler that complies the guesse.cpp into
    guesse.exe and copy guesse.exe to a floppy disk.

    The *switch* statement instead of *if and else*.

    http://www.cplusplus.com/doc/tutorial/control.html

    Duane :)
    Duane Arnold, Jun 23, 2006
    #2
    1. Advertising

  3. Hoogan $$$

    Robert Baer Guest

    Duane Arnold > wrote:

    > Hoogan $$$ wrote:
    >
    >> I designed a program (C++),using "if & else" to my brother (child) as
    >> a game
    >> to guess any number and see if matches with magic number or not. The
    >> program
    >> is working good.
    >> But I don't know how can I copy it on floppy for example to give it to
    >> him
    >> to let him run on his computer. The program is found and operated by the
    >> original C++ program and its name file " guesse.cpp". The original C++
    >> is a
    >> teaching program (teach your self)
    >> Please can I find help.
    >> Thank you all.
    >>
    >>
    >>

    >
    > You find yourself a compiler that complies the guesse.cpp into
    > guesse.exe and copy guesse.exe to a floppy disk.
    >
    > The *switch* statement instead of *if and else*.
    >
    > http://www.cplusplus.com/doc/tutorial/control.html
    >
    > Duane :)

    IF-ELSE is preferred with one or two choices; SWITCH is preferred if
    three or more choices.
    Robert Baer, Jun 23, 2006
    #3
  4. Hoogan $$$

    Duane Arnold Guest

    Robert Baer wrote:
    > Duane Arnold > wrote:
    >
    >> Hoogan $$$ wrote:
    >>
    >>> I designed a program (C++),using "if & else" to my brother (child) as
    >>> a game
    >>> to guess any number and see if matches with magic number or not. The
    >>> program
    >>> is working good.
    >>> But I don't know how can I copy it on floppy for example to give it
    >>> to him
    >>> to let him run on his computer. The program is found and operated by the
    >>> original C++ program and its name file " guesse.cpp". The original
    >>> C++ is a
    >>> teaching program (teach your self)
    >>> Please can I find help.
    >>> Thank you all.
    >>>
    >>>
    >>>

    >>
    >> You find yourself a compiler that complies the guesse.cpp into
    >> guesse.exe and copy guesse.exe to a floppy disk.
    >>
    >> The *switch* statement instead of *if and else*.
    >>
    >> http://www.cplusplus.com/doc/tutorial/control.html
    >>
    >> Duane :)

    >
    > IF-ELSE is preferred with one or two choices; SWITCH is preferred if
    > three or more choices.


    You can bet the OP has more than two if=else statements in-line.

    Some programmers use nothing but *Switch* statements and will try to
    avoid using any if statements in OOP(s) programming and consider it a no no.

    Duane :)
    Duane Arnold, Jun 24, 2006
    #4
  5. Hoogan $$$

    Robert Baer Guest

    Duane Arnold > wrote:
    > Robert Baer wrote:
    >
    >> Duane Arnold > wrote:
    >>
    >>> Hoogan $$$ wrote:
    >>>
    >>>> I designed a program (C++),using "if & else" to my brother (child)
    >>>> as a game
    >>>> to guess any number and see if matches with magic number or not. The
    >>>> program
    >>>> is working good.
    >>>> But I don't know how can I copy it on floppy for example to give it
    >>>> to him
    >>>> to let him run on his computer. The program is found and operated by
    >>>> the
    >>>> original C++ program and its name file " guesse.cpp". The original
    >>>> C++ is a
    >>>> teaching program (teach your self)
    >>>> Please can I find help.
    >>>> Thank you all.
    >>>>
    >>>>
    >>>>
    >>>
    >>> You find yourself a compiler that complies the guesse.cpp into
    >>> guesse.exe and copy guesse.exe to a floppy disk.
    >>>
    >>> The *switch* statement instead of *if and else*.
    >>>
    >>> http://www.cplusplus.com/doc/tutorial/control.html
    >>>
    >>> Duane :)

    >>
    >>
    >> IF-ELSE is preferred with one or two choices; SWITCH is preferred if
    >> three or more choices.

    >
    >
    > You can bet the OP has more than two if=else statements in-line.
    >
    > Some programmers use nothing but *Switch* statements and will try to
    > avoid using any if statements in OOP(s) programming and consider it a no
    > no.
    >
    > Duane :)

    An efficent compiler would follow the syntax. meaning IF/THEN/ELSE
    should be used for one or two conditions and a Switch for three or more
    conditions.
    However, if post-processing optimization is done and efficently, then
    the use of SWITCH for all cases becomes acceptable.
    But to blindly program with some given approach for all cases is
    definitely not good programming practice; a robot (AKA program) could do
    that...
    Robert Baer, Jun 24, 2006
    #5
  6. Hoogan $$$

    Duane Arnold Guest

    Robert Baer wrote:
    > Duane Arnold > wrote:
    >
    >> Robert Baer wrote:
    >>
    >>> Duane Arnold > wrote:
    >>>
    >>>> Hoogan $$$ wrote:
    >>>>
    >>>>> I designed a program (C++),using "if & else" to my brother (child)
    >>>>> as a game
    >>>>> to guess any number and see if matches with magic number or not.
    >>>>> The program
    >>>>> is working good.
    >>>>> But I don't know how can I copy it on floppy for example to give it
    >>>>> to him
    >>>>> to let him run on his computer. The program is found and operated
    >>>>> by the
    >>>>> original C++ program and its name file " guesse.cpp". The original
    >>>>> C++ is a
    >>>>> teaching program (teach your self)
    >>>>> Please can I find help.
    >>>>> Thank you all.
    >>>>>
    >>>>>
    >>>>>
    >>>>
    >>>> You find yourself a compiler that complies the guesse.cpp into
    >>>> guesse.exe and copy guesse.exe to a floppy disk.
    >>>>
    >>>> The *switch* statement instead of *if and else*.
    >>>>
    >>>> http://www.cplusplus.com/doc/tutorial/control.html
    >>>>
    >>>> Duane :)
    >>>
    >>>
    >>>
    >>> IF-ELSE is preferred with one or two choices; SWITCH is preferred
    >>> if three or more choices.

    >>
    >>
    >>
    >> You can bet the OP has more than two if=else statements in-line.
    >>
    >> Some programmers use nothing but *Switch* statements and will try to
    >> avoid using any if statements in OOP(s) programming and consider it a
    >> no no.
    >>
    >> Duane :)

    >
    > An efficent compiler would follow the syntax. meaning IF/THEN/ELSE
    > should be used for one or two conditions and a Switch for three or more
    > conditions.


    > However, if post-processing optimization is done and efficently, then
    > the use of SWITCH for all cases becomes acceptable.


    > But to blindly program with some given approach for all cases is
    > definitely not good programming practice; a robot (AKA program) could do
    > that...


    You say the to some of the OPPs experts that I have studied and worked
    with and they would object to any if statement in code.

    And if you have had to clean-up code done by some junior programmer that
    went wild with the *if then else or elseif*, then you would aprciate
    avoiding the *if*.


    I have seen this too many times.

    if
    if
    if
    if
    if
    if
    if
    if
    else
    else
    else
    else
    else
    else
    else
    else

    <sinp>
    > However, if post-processing optimization is done and efficently, then
    > the use of SWITCH for all cases becomes acceptable.


    <snip>

    It's also about readability and maintainability that the next programmer
    must deal with in working with code.

    The simpler the code, the better it is to maintain.
    Duane Arnold, Jun 24, 2006
    #6
  7. Hoogan $$$

    Robert Baer Guest

    Duane Arnold > wrote:
    > Robert Baer wrote:
    >
    >> Duane Arnold > wrote:
    >>
    >>> Robert Baer wrote:
    >>>
    >>>> Duane Arnold > wrote:
    >>>>
    >>>>> Hoogan $$$ wrote:
    >>>>>
    >>>>>> I designed a program (C++),using "if & else" to my brother (child)
    >>>>>> as a game
    >>>>>> to guess any number and see if matches with magic number or not.
    >>>>>> The program
    >>>>>> is working good.
    >>>>>> But I don't know how can I copy it on floppy for example to give
    >>>>>> it to him
    >>>>>> to let him run on his computer. The program is found and operated
    >>>>>> by the
    >>>>>> original C++ program and its name file " guesse.cpp". The original
    >>>>>> C++ is a
    >>>>>> teaching program (teach your self)
    >>>>>> Please can I find help.
    >>>>>> Thank you all.
    >>>>>>
    >>>>>>
    >>>>>>
    >>>>>
    >>>>> You find yourself a compiler that complies the guesse.cpp into
    >>>>> guesse.exe and copy guesse.exe to a floppy disk.
    >>>>>
    >>>>> The *switch* statement instead of *if and else*.
    >>>>>
    >>>>> http://www.cplusplus.com/doc/tutorial/control.html
    >>>>>
    >>>>> Duane :)
    >>>>
    >>>>
    >>>>
    >>>>
    >>>> IF-ELSE is preferred with one or two choices; SWITCH is preferred
    >>>> if three or more choices.
    >>>
    >>>
    >>>
    >>>
    >>> You can bet the OP has more than two if=else statements in-line.
    >>>
    >>> Some programmers use nothing but *Switch* statements and will try to
    >>> avoid using any if statements in OOP(s) programming and consider it a
    >>> no no.
    >>>
    >>> Duane :)

    >>
    >>
    >> An efficent compiler would follow the syntax. meaning IF/THEN/ELSE
    >> should be used for one or two conditions and a Switch for three or
    >> more conditions.

    >
    >
    >> However, if post-processing optimization is done and efficently,
    >> then the use of SWITCH for all cases becomes acceptable.

    >
    >
    >> But to blindly program with some given approach for all cases is
    >> definitely not good programming practice; a robot (AKA program) could
    >> do that...

    >
    >
    > You say the to some of the OPPs experts that I have studied and worked
    > with and they would object to any if statement in code.
    >
    > And if you have had to clean-up code done by some junior programmer that
    > went wild with the *if then else or elseif*, then you would aprciate
    > avoiding the *if*.
    >
    >
    > I have seen this too many times.
    >
    > if
    > if
    > if
    > if
    > if
    > if
    > if
    > if
    > else
    > else
    > else
    > else
    > else
    > else
    > else
    > else
    >
    > <sinp>
    > > However, if post-processing optimization is done and efficently, then
    > > the use of SWITCH for all cases becomes acceptable.

    >
    > <snip>
    >
    > It's also about readability and maintainability that the next programmer
    > must deal with in working with code.
    >
    > The simpler the code, the better it is to maintain.
    >
    >
    >
    >

    Another problem with multi-level IF statements is that it is
    inefficent as all heck in code generated and the amount of execution
    time grows.

    What is worde than code created by junior programmers, is a program
    "patched" umpteen times by them and/or programmers under pressure to
    "get it done NOW".
    Spaghetti code?
    Hell, i have seen programs so bad that it was a miracle that the
    computer could follow it and another that something that resembled
    usefulness was a result.
    Robert Baer, Jun 25, 2006
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rick

    OT: Programmers

    Rick, Jul 21, 2004, in forum: MCSE
    Replies:
    2
    Views:
    392
  2. Mavra Chang
    Replies:
    11
    Views:
    976
    trout
    Feb 20, 2004
  3. Vallant
    Replies:
    13
    Views:
    1,504
    Anonymous
    Sep 16, 2004
  4. Vallant
    Replies:
    15
    Views:
    531
    Anonymous
    Sep 16, 2004
  5. Janice P.
    Replies:
    16
    Views:
    701
    Rizzo
    Jan 12, 2007
Loading...

Share This Page