Help with flowcharts.

Hello everyone! I am having a bit of trouble in my online c++ class and I need some help drawing a flowchart for my design work. I already did the program without doing the flowchart (I haven't done one before and have no idea what to do). I could use some help creating a flowchart for this program. And are there any places where I can create flowcharts easily on the internet?

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
  using namespace std;



int main ()
{
	
	
	int selection = 0;
	double input1(0.0);
	double input2(0.0); 
    char indicator('n');

cout << "Welcome to Andrew's C++ Calculator" << endl;

cout << " Please enter two integers to find the sum, difference, product, quotient, square root, and power of " << endl;

for (;;)
 {
 	cin >> input1;
    cin >> input2;

cout << " The difference of "  << input1 << " minus " << input2 << " is " << input1-input2 << endl;

cout << " The sum of " << input1 << " plus " << input2 << " is " << input1+input2 << endl;

cout << " The product of " << input1 << " times " << input2 << " is "  << input1*input2 << endl;

cout << " The quotient of " << input1 << " divided by " << input2 << " is " << input1/input2 << endl;

cout << " The square root of " << input1 << " is " << sqrt( input1 );

cout << input2 << " to the 4th power is " << pow( input2,4 );


}
 
 }
Umm...Line 18 is pretty bad especially since you never even put a break/return anywhere the program will never end.. Also for( ; ; ) looks tacky I would suggest a while loop and have a code to quit (eg if the user inputs a -99 or something then quit.

As for a flow chart you will put what the program does.


like this

------------------
|Loop forever|
------------------
|
------------------------
|Get 2 user inputs|
------------------------
|
-------------------------
|Compute difference|
--------------------------
|
-------------------
|compute sum|
-------------------

.....


Yours doesn't really have any branches since you have no conditions with multiple paths.

http://office.microsoft.com/en-us/visio-help/create-a-basic-flowchart-HP001207727.aspx
http://www.edrawsoft.com/How-to-draw-flowchart.php
http://lmgtfy.com/?q=how+to+create+a+flow+chart
Ahhh okay sweet, thanks a ton. I do have another question because I have to do this for another program and I am freaking out as well. How would I go about making a chart for a program like this?

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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99

using namespace std;

#include <iostream>
#include <string>

int main (){
		
		string first_name;
		string last_name;
		int idnum;
		int jobclass;
		int totalhours;
		
		
		
	cout << " State employee's name. ( First, Last ) " << endl;
	cin >> first_name;
	cin >> last_name;
	
	cout << " State your Id Number. " << endl;
	cin >> idnum; 
	
	cout << " State job classification. " << endl;
	cin >> jobclass;
	
	cout << " Hours worked this week: " << endl;
	cin >> totalhours;
	
	
		double hourlyrate;
	
	switch (jobclass){
		
	case 1: 
		hourlyrate = 5.50;
		break;
		
	case 2:
		hourlyrate = 6.00;
		break;
			
	case 3:
		hourlyrate = 7.00;
		break;
				
	case 4:
		hourlyrate = 9.00;
		break;
		
	case 5:
		hourlyrate = 12.00;
		break;
		
	default:
		hourlyrate = 5.50;
		break;	
	}
	
	int overtimehours, regularhours;
	
	if (totalhours > 40){ //employee worked more than regular hours
	    overtimehours = totalhours - 40;
		regularhours =40;
}
	else { //employee didn't work more than regular hours
	   overtimehours = 0;
	   regularhours = totalhours;
	}
	
	
		double reg_pay;
		double overtime_pay;
	
	reg_pay = regularhours * hourlyrate;
	overtime_pay = (overtimehours) * 1.5 * hourlyrate;
	
	
	cout << " Employee Name: " << first_name << " " << last_name << " ID. Number: " << idnum << endl;
	cout << " Job Classification: " << jobclass << " Hourly Rate " << hourlyrate << endl;
	cout << " Total Hours Worked: " << totalhours << " Overtime Hours: " << overtimehours << endl;
	cout << " Regular Pay: " << reg_pay << " Overtime Pay: " << overtime_pay << endl;
	cout << " Total Earnings ......... " << reg_pay + overtime_pay << endl;
	
	if (totalhours < 40){	
		cout << " Inadequit number hours worked. " << endl;
	}
	
	if (totalhours > 60){
		cout << " Excessive number of hours worked! " << endl;
	}
	
	if (jobclass < 1 || jobclass > 5) {
		cout << " **** The Employee's Job Classification is in error **** " << endl;	
	}
	
	
}
basically condition's are like this

_____________
|some condition|
---------------------
_____|_______...._________________
|If something....|---|if something else...|
---------------------...---------------------------
______|____........________|___
|do this.......|........|do something|
----------------.........-------------------
_____________|_____
|Next thing in the chart|
-------------------------------
Topic archived. No new replies allowed.