Flowchart Help

Pages: 12
closed account (48T7M4Gy)
It might be safer if you just post the code in the normal way rather than your download.
@kemort, hi again bro thank you for helping me the last time i asked for help.

now my problem is i need to make a flowchart of every program that i posted here.
here is my 1st program
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include<iostream.h>
#include<conio.h>
main(){
	int n1,n2,n3,n4,n5,sum,a;
	a+=1;
	clrscr();
	cout<<"Enter number #1:";
	cin>>n1;

	do{
	if(n1<0)
		{
		cout<<""<<n1<<" is negative";
		}
		else
		{
		if(n1>0)
		{
		cout<<""<<n1<<" is positive";
		}
		}
	cout<<"\n\nEnter number #2:";
	cin>>n2;
	if(n2<0)
		{
		cout<<""<<n2<a
		else
		{
		if(n2>0)
		{
		cout<<""<<n2<<" is positive";
		}
		}
	cout<<"\n\nEnter number #3:";
	cin>>n3;
	if(n3<0)
		{
		cout<<""<<n3<<" is negative";
		}
		else
		{
		if(n3>0)
		{
		cout<<""<<n3<<" is positive";
		}
		}
	cout<<"\n\nEnter number #4:";
	cin>>n4;
	if(n4<0)
		{
		cout<<""<<n4<<" is negative";
		}
		else
		{
		if(n4>0)
		{
		cout<<""<<n4<<" is positive";
		}
		}
	cout<<"\n\nEnter number #5:";
	cin>>n5;
	if(n5<0)
		{
		cout<<""<<n5<<" is negative";
		}
		else
		{
		if(n5>0)
		{
		cout<<""<<n5<<" is positive";
		}
		}
	sum=n1+n2+n3+n4+n5;
	cout<<"\n\nThe sum of all the numbers entered is "<<sum<<"";
	}
	while(a<=5);
	getch();
	return 0;
}
closed account (48T7M4Gy)
Hi again abu... that's better - we never know what sort of danger downloads bring.

So where are you going to start with a flow chart?

It looks like this program whould at least have a circular 'blob' at the start with another one with an incoming arrow at the end.

I suspect you might have a couple of decision diamonds and arrows in and out too.
          START            
              |
              V
         input n1
              |
              V
        is n1 < 0?
         |        |
         V        V
       yes      no
         :         |
         :         V
                 print 'negative'


There you are, I've just about done your assignment for you. Probably better/erasier to use Word or Flow Charter software if you can or even a pencil and paper.


Last edited on
@kemort
thank you kemort how about the flowchart for this program?
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
#include<iostream.h>
#include<conio.h>
main(){
	 int mnumber,guess,tries=1;
	 clrscr();
	 cout<<"Enter the magic number:";
	 cin>>mnumber;
	 clrscr();
	 for(;tries<100000;tries++)
	 {
		cout<<"\nEnter your guess:";
		cin>>guess;
			if(guess==mnumber)
			{
			cout<<"You're right! You've got the magic number!";
			break;
			}
			else if (guess<mnumber)
			{
			cout<<"Your guess is TOO LOW!";
			}
			else
			{
			cout<<"Your guess is TOO HIGH!";
			}

	 }
	 cout<<"\n\nNumber of Tries:"<<tries<<"";
	 cout<<"\n\nThank you for using this program!";
	 getch();
	 return 0;

}
closed account (48T7M4Gy)
As a guide

1. there is a start
2. some input

3. loop starts at try 1 with a limit of 1000000 tries
4. input a guess
5. decide on size compared to actual value or whether successful and loop back or finish

6. say thank you
7. end

@kemort
am i doing it right for machine number 1?
http://imgur.com/wWYBO0W
closed account (48T7M4Gy)
looks good. but two points to note:

- what is the do for?
- don't forget the decision point has two paths not just 1
Last edited on
@kemort

the there is "do" there because the instruction in making the program is use a do or do while loop.
closed account (48T7M4Gy)
yeah that's ok but you don't do it that way. for loops are made up of a decision diamond, program step rectangle and path arrows. I can't draw it for you here but you can get plenty of examples if you google "c++ for loop"
this is the update for the first program's flow chart

should i only use 1 headed arrow?
http://imgur.com/b5qqqBr
closed account (48T7M4Gy)
Great improvement.
- u need arrowheads at the end of every line.
- inputs are often rectangles with rounded corners.
- program steps are often rectangles with sharp corners.



Hi @kemort

This is the updated part,
http://imgur.com/VtkByTa

is it really gonna be that long?
closed account (48T7M4Gy)
Yeah, could be that long. You need to make sure that there is one start and one end. You can't just stop anywhere the way you have shown.
@kemort
ya it's not yet finished i'll end this up and post the finish product here
@kemort

here's the finish product. what do you think?
http://imgur.com/ec6IUAM
closed account (48T7M4Gy)
Looks pretty good except you can't leave dead end branches. All you do is draw an arrow all the way to to the end or have a dashed line/arrow to an indicative end. The important thing is you can't allow a path to dangle in space - it's unfair.

Cheers
@kemort how about the 2nd machine problem, the magic number. how do i do the flowchart
closed account (48T7M4Gy)
'magic number' what is this?

hey you're an expert now abu ... all you need to do is go back and have a look at my comment on this first up and 'get into it', as they say.
@kemort oh i forgot

how about this program, please give me a guide on this program's flowchart
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
51
52
53
#include<iostream.h>
#include<string.h>
#include<conio.h>

int main(){
	clrscr();
	char Username[30]="sammasangcap",Password[30]="abc123",username[30],password[30],age[2],name[60],sex[6],address[100];
	unsigned int attempts =0;
	do
	{
	cout<<"\nUsername:";
	cin>>username;

	if(strlen(username) <4)
	{
		cout<<"\nUsername length must be atleast 4 characters";
	}
	else
	{
		cout<<"\nPassword:";
		cin>>password;
	}

	if(! ( (strcmp(username,Username) == 0) && (strcmp(password,Password) == 0)))
	{
		cout<<"\nInvalid Username and/or Password! Please try again!";
		attempts++;
		if(attempts == 3)
		{
			cout<<"\n\nYou exceeded the number of times that you need to input the correct username and password.\n******The system is now locked! ******";
			break;
		}
	}
	else
	{
		cout<<"\nLogin Succesful!";
		cout<<"\nPlease input the following information:";
		cout<<"\nName:";
		cin>>name;
		cout<<"\nAge:";
		cin>>age;
		cout<<"\nSex:";
		cin>>sex;
		cout<<"\nAddress:";
		cin>>address;
		cout<<"\nHi "<<name<<"! I am glad to meet you. You are a "<<sex<<" student and your age is "<<age<<". Hope to see you in "<<address<<". Thank you for using my program.";

		break;
	}
}while(1);
	getch();
	return 0;
}
Pages: 12