Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

UnkleRhaukus

  • 2 years ago

.c code

  • This Question is Closed
  1. UnkleRhaukus
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    This is one of my first programs in c can it be simplified? improved? is there someway to get the correct and incorrect paths to be nearer to each other in the code?

  2. UnkleRhaukus
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    1 Attachment
  3. e.mccormick
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    To be honest, there is generally going to be better input verification. This would not simply things, but prevents issues caused by input that is designed to be harmful. Also, a lot of what makes C, and many other languages, more powerful is the use of functions or sub routines. As you go on, you will learn about those and how they can make programs more flexible and efficient.

  4. wio
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    There is one way you can really simplify the code. Change ``` if ( condition ) { print( correct answer ); remaining program } else { print( wrong answer ); } ``` To ``` if ( condition ) { print( correct answer ); } else { print( wrong answer ); return 0; } remaining program ``` This will prevent nesting and make the flow or your program much more linear. Another thing you should do is implement functions.

  5. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy