functions

Write your question here.
Its not running
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
  #include <iostream>
#include <string>
using namespace std;


void Input(string & cell_number, int & relays, int & call_length);
void Output(const string cell_number, const int relays, double tax_rate,const int call_length, const double & net_cost, const double & call_tax, const double & total_cost_of_call);
void Process(const int relays, const int call_length, double & tax_rate, double & net_cost, double & call_tax, double & total_cost_of_call);

void Input(string & cell_number, int & relays, int & call_length)
{
	cout << "Enter your Cell Phone Number: ";
	cin >> cell_number;
	cout << "Enter the number of relay stations: ";
	cin >> relays;
	cout << "Enter the length of the call in minutes: ";
	cin >> call_length;
	
	
}

void Process(const int relays, const int call_length, double & net_cost, double & call_tax, double & total_cost_of_call, double tax_rate)
{
	if (relays >= 0 && relays <= 5)
	{
		tax_rate = .01;
	}
	else if (relays >= 6 && relays <= 11)
	{
		tax_rate = .03;
	}
	else if (relays >= 12 && relays <= 20)
	{
		tax_rate = .05;
	}
	else if(relays >= 21 && relays <= 50)
	{
		tax_rate = .08;
	}
	else if (relays > 50)
	{
		tax_rate = .12;
	}

	net_cost = (((double)relays / 50) * 0.40) * call_length;
	call_tax = net_cost * tax_rate;
	total_cost_of_call = net_cost + call_tax;

}


void Output(const string cell_number, const int relays, const int call_length, const double tax_rate, const double & net_cost, const double & call_tax, const double & total_cost_of_call)
{
	
	cout.precision(2);
	
	cout << "Net Cost:                 " << '\t' << net_cost << endl;

	cout << "Tax Rate:                 " << '\t' << tax_rate << endl;

	cout << "Call Tax:                 " << '\t' << call_tax << endl;

	cout << "Total Cost Of Call:       " << '\t' << total_cost_of_call << endl;

}

int main() 
{
	string cell_number;
	int  relays;
	int  call_length;
	double net_cost;
	double tax_rate;
	double call_tax;
	double total_cost_of_call;



	Input(cell_number, relays, call_length);
	Process(relays, call_length, net_cost, call_tax, total_cost_of_call,tax_rate);
	Output(cell_number, relays, call_length, net_cost,tax_rate, call_tax, total_cost_of_call);

	return 0;
}
You need to declare functions differently.

signatures -
main function
implementations.

for example.

1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>

void helloWorld();

int main() {
    helloWorld ();
    return 0;
}

void helloWorld() {
    std::cout << "hello world" << std::endl;
}
Topic archived. No new replies allowed.