I am posting my homework assignment for some input. Up until now all of my assignments have been right but I do not know why. If my assignment is right let me know but I need someone to explain to me why it is right. PLEASE HELP!

I attached my assignment but I will copy it to.

input X input 95

if (0 <= X and X < 49) if (0 <= 95 and 95 < 49)
output "you fail" output “ you fail”

else if (50 <= X and X < 70) else if (50 <= 95 and x < 70)
output "your grade is" X output “95”
output "you did OK" output “you did ok”

else if (70 <= X and X < 85) else if (70 <= 95 and 95 < 85)
output "your grade is" X output “your grade is 95 “
output "you did well" output “you did well”

else if (85 <= X and X < 100) else if (85 <= 95 and 95 < 100
output "your grade is" X output “your grade is 95”
output "you did great" output “you did great”

endif endif
output "how did you do?" output “ how did you do?”

Recommended Answers

All 9 Replies

if((x<49)||(x>=0)) {
   printf("You fail\n";)
}

Now put some effort for finishing your homework.

if((x<49)||(x>=0)) {
   printf("You fail\n";)
}

Actually it should be if((x<49) && (x>=0)) . What you wrote will always be true. :)
Or if you where trying to make a statement, I would do it more efficient:

while (1) 
    printf("You fail\n");

>If my assignment is right let me know but I need someone to explain to me why it is right.
Why? Are you completing them through automatic writing or channeling or something?

>If my assignment is right let me know but I need someone to explain to me why it is right.
Why? Are you completing them through automatic writing or channeling or something?

No. Like I said most of them has been right but I do not understand why they are right. I would like to understand what I am doing.

>If my assignment is right let me know but I need someone to explain to me why it is right.
Why? Are you completing them through automatic writing or channeling or something?

Although this was harsh, it was hilarious.

Win.

Actually it should be if((x<49) && (x>=0)) . What you wrote will always be true. :)
Or if you where trying to make a statement, I would do it more efficient:

while (1) 
    printf("You fail\n");

I do not understand where you get the those responses. The readinf material does not specify a language to use. Is there a default language that I should use. The text book we use is extended prelude to programming concepts and design 2nd edition.

Although this was harsh, it was hilarious.

Win.

I think he is a jerk. I am really trying to understand what I am doing. You cannot be a good program writer or anything that you do if you cannot have a good understanding of what you are doing.

I think he is a jerk. I am really trying to understand what I am doing. You cannot be a good program writer or anything that you do if you cannot have a good understanding of what you are doing.

I've been on these forums for awhile now. Ezzaral has helped countless students and industry programmers with common problems.

The way you say you have been "getting things right" even though you don't understand how leads many to conclude that--

a) You are copying and pasting code given to you by your Instructor and you tinker around with it until your program has enough specs to gain you a passing grade.

b) Your Instructor is far too lenient in passing its students, or

c) The assignments aren't too difficult at all, or

d) You're getting the solutions from an external source (which is what Ezzaral pointed out, except I believe he was somewhat harsh although it could've been worst in a way that one would believe you're cheating your way through these assignments).


In any case, the best way to understand the program is to first understand what your intent is before you program.

Study the assignment's intent, then study the language you intend to you and how you can do certain things.

In my opinion, programming is nothing more than an interface that allows users/people (aka programmers) to interface with a computer. The basic functions of a programming langauge are typically a means of storing data and retrieving it, with some "jazzed up" additions that allow data to be stored in different ways via loops and conditions.

Write out your logic on a plain piece of paper first (basically, what do you want to happen during a particular condition) then refer to your programming language documentation for ways of using its implementations.

Attempting to immediately code your solution without knowing how the language works can cause you to lose track of your overall intent for how the program functions to the point that you'd be lucky that the program works at all. Don't fall into this trap - take it slow and work it out on paper first then code.

Yeah, it's really hard to understand why you wouldn't already be able to tell whether your solution was right.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.