Quantcast

A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

UnkleRhaukus

  • one year ago

.c code

  • This Question is Closed
  1. UnkleRhaukus
    • one year 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
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    1 Attachment
  3. e.mccormick
    • one year 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
    • one year 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

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.