Flow Charts -question

Thread Starter

Gajyamadake

Joined Oct 9, 2019
310
I have noticed that my problem solving skills in c programming is too weak so i want to improve it. I should fix the problem in flow chart first instead of writing c code, I think I should make some flow chart to solve the simple problem to before writing the code for microcontroller .When I will get enough Knowledge, I will work on microcontroller again

I want to convert following table into a flow chart

Student StatusScore in Exam
Fail0-29
Pass30-100
Third Division30-45
Second Division46-65
First Division66- 75
honours76- 100
This is my first attempt


1578310262523.png

I have prepared this flow chart And I think this solves the all problem

The question in your mind is, if this solves the all problem then why did I ask question. Its answer is that according to me it is correct But i can be wrong Either you can also tell about how to make it better. that's why I shown my all work for better advice.

If you find something wrong then someone can tell me

Edit: I have attached PDF file for clarity
 

Attachments

Thread Starter

Gajyamadake

Joined Oct 9, 2019
310
Next, don't make the same decision more often than necessary. Here is a hint;
What is the use of this, I think This will minimize the chances of making mistakes

Edit : In my flow chart, I am only checking true condition. I don't think i should change decision making. should I? So if else condition is true then what will be the statement
 
Last edited:

WBahn

Joined Mar 31, 2012
29,978
A good flow chart should have exactly one start symbol and one stop symbol. Sometimes this can get messy and so people do what you did and have multiple stop symbols, but when this happens a better solution is to further break down the problem into smaller pieces in which each can be represented by a cleaner flowchart.
 

jpanhalt

Joined Jan 18, 2008
11,087
1578324281845.png

1) What does "Stop" result in? No grade? Hanging? Pass with distinction?

2) It is customary but not required to use one axis (say vertical) for "yes" and the other for "no."
 

WBahn

Joined Mar 31, 2012
29,978
But i have to make same decision twice, you said that is not efficient so can you tell me how to change decision making



View attachment 196242
If you first check to see if the A is less than 50 and it's not, then when you go down the NO side and hit another decision that handles the case of A being between 50 and 75, there is no need to check if A is greater than or equal to 50 because the only way you could get to that point in the flow chart was for that condition to be met. So you only need to check to see if A is less than 75.
 

WBahn

Joined Mar 31, 2012
29,978
The original specification has scores <0 or >100 as being undefined. The TS's original flowchart has them as being FAIL. They should be left as undefined or a reasonable supplement to the specs should be made and documented.
 

MrChips

Joined Oct 2, 2009
30,712
What is the use of this, I think This will minimize the chances of making mistakes
What do you mean by making mistakes?

Computers don't make mistakes. Programs don't make mistakes. Or they are not supposed to make mistakes unless there is a hardware failure.

Programmers make mistakes.
 

WBahn

Joined Mar 31, 2012
29,978
What is the use of this, I think This will minimize the chances of making mistakes

Edit : In my flow chart, I am only checking true condition. I don't think i should change decision making. should I? So if else condition is true then what will be the statement
Only doing things once not only usually produced cleaner, tighter, more efficient code, but it also greatly improves the maintainability of the code.

For instance, let's say that the cut between First Division and Second Division was changed from 65 to 60. In your code you would have to make that change in two places. What if you only made it in one of them because you (or whomever was responsible for maintaining your code after you leave) saw the first one, changed it, and thought you were done? Now your code is broken in ways that may be hard to track down and fix. Instead, write your code so that there is exactly one place where the value of that cut (and the others) is located so that changing in that one place makes the code work correctly. Even better, put all of the those values in the same portion of the code so that they are all together and easy to see.
 

Thread Starter

Gajyamadake

Joined Oct 9, 2019
310
Keep it simple:
The condition in your flow chart is incomplete

The original specification has scores <0 or >100 as being undefined. The TS's original flowchart has them as being FAIL.
This is my first flow chart but I have modified the conditions
1578330078962.png

My question is whether my flow chart follows the given table or not. If not then where it become fail?

Edit: The first priority is to make the correct the flow chart After that i can think of cleaning it as @MrChips said
 

MrChips

Joined Oct 2, 2009
30,712
Why are you making the same mistakes even though these were indicated to you?

1) The decision box has two outcomes. Your flowchart shows only one.

2) Once you have determined the proper division, why keep on testing?
 

jpanhalt

Joined Jan 18, 2008
11,087
@Gajyamadake
With reference to post #18... Let me offer a suggestion. It is not meant in the least to be a criticism but to offer a process that might help.

I have the feeling that you are looking at "flowcharts" as an end or a product. In reality, they should be a procedure to help you reach an end. Maybe it would help avoid the sort of errors pointed out in post #19, if you printed out your flowchart and then went through each step.

When I do a flowchart, I have a difficult time detecting all the errors and/or unaddressed options while it is on my computer screen. I print it out and frequently take a break. Then return with pencil and trace through every step. I am far more likely to find things that need to be changed than to find the chart acceptable at that stage.

In my experience, the process is never completely done. When I was working, we had flow charts that had existed for years, been contributed to by many authors, and had been reviewed at least once a year by those authors and others. It was more common that such charts would be edited at each review than pass such review without edits.
 
Top