Flowchart needs explaining

Hello.

I need some people to help me explain a flowchart to the doctor in my university.

Here is the flowchart... help would be appreciated.

http://i.imgur.com/7ZGZyNk.jpg

Thanks.


Note: the code is already written, and this is not for me, its for a friend.
That is not a flowchart. It is random squares with nonsence written in it.
It is a typical flowchart in our course :<
Except is not.
http://en.wikipedia.org/wiki/Flowchart

From the look at that "flowchart" shape I can assume that your program does not have a single if statement or loop.

It looks that somebody took program, butchered it to two-lines pieces and made a string of boxes each of which containing single piece. After that he bastardized lines even more to make it look like "pseudocede" and finally remembered that there is another shapes changed some of them to rhombuses without regard what is it actually means. Not to mention adding random "yes" to the lines and do not adding them to the only place where they would be nessesary.
Last edited on
Okay.

And there is an if.

And here is the code...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include<iostream>
using namespace std;
void main()
{
  int grades [4] = {0,0,0,0};
  int marks = 0;
  int counter = 0;

while (marks<=100)
{
  cin>>marks;
    if (marks > 100)
        break;
    if (marks >= 80)
        grades [3] ++;
    else if (marks >= 60)
        grades [2] ++;
    else if (marks >= 40)
        grades [1] ++;
    else
        grades [0] ++;
}

}
while (counter < 4)
{
   if (counter == 0)
       cout << "0-29";
   else if (counter == 1)
       cout << "30-39";
   else if (counter == 2)
       cout << "40-69";
   else
       cout << "70 - 100";

for (int i=1; i <= grades [counter] ; i++)
{
   cout << "*";
   counter ++;
}

for (int i=0 ; i <= grades [counter] ; i++ 
{
  deviation[i]=grade[i]-average;
  cout<<grade[i]<<"\t"<<deviation[i]<<endl;
}

cout<<endl;
system("PAUSE");
}


Help would be appreciated now. :3
Last edited on
As MiiNiPaa says, its obvious that code came before thought. you cant hand that in mate,
the shapes are all correct flow chart shapes, rectangles, diamonds etc joined together by arrows to indicate flow, BUT t's reduced to giberish by what was written in the shapes.

You and your friend need to dry run that chart so that you understand whats wrong with it. You also need to check how to represent loops and switches in a flowchart.

here's a starter for you :)
http://lmgtfy.com/?q=flowchart+examples
Last edited on
Guys! This is not a flowchart we made, its a flowchart that is needed to be explained!

My friend wants to "present" what the flowchart is saying, he wants to "explain" it, it is not done by him nor me.

He needs help with explaining the flowchart because he didn't make the code.

Explaining the code (What the program does) would be enough honestly.

Its a group project thingy , its complicated, but just explain what the damn program does please xD
Last edited on
That is how flowchart for lines 9-22 would look: http://puu.sh/94Plu/c7aaf90e67.png

Flowchart is a simplified algorithm which tells what to do. All point of flowchart is to be simple enough that monkey could follow it. If you need to explain a flowchart, it is not a correct flowchart. Not to mention that whoever did that abomination does not have a slightest idea how flowchart works.

what the damn program does please
Loops infinitely from what I see.
Loops infinitely from what I see.


I lost all hope here.
Oh. It might not loop indefinetly depending where missing closing bracket '}' is. I made my assumptions from identation, but it actually either loop indifinetly or wrecks random memory.

The more I look at the program the more mistakes I find. It was clearly written without thought. That is why you should write flowchart before coding.
so did we, you wanted us to do your homework for you :(
Its okay people.

I already finished this course but my friends are taking it and they are struggling at this part. So...


Thanks for your time!
Last edited on
Humem, the problem here is that the program doesn't work and the flow chart doesn't reflect what the program should do. In fact, the flow chart isn't even a real flow chart.
- in the first diamond, which branch is for yes, and which is for no? It looks like you expect the left branch for "yes".
- In the second diamond, you show the flow going INTO the left side - flow should go in the top. Also, this is a branch but it shows only one exit.
- The two "else" boxes show a "yes" exit. Those should be reserved for decisions.
- I don't know what's going on with the for loops.

You need to get the code and the flow chart to accurately reflect the solution to the problem. MiiniPaa's flow chart is a good example for the first part.

For what it's worth, I find flow charts pretty useless for expressing algorithms. Pseudo code is much more useful because it reflects the structure that will become code.
Topic archived. No new replies allowed.