hi..help me finish this one please

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
#include <iostream>
#include <cmath> 

using namespace std;

#include <cstdlib>
#include <ctime>

using namespace std;



int rial()
{

int rial;

unsigned seed = time(0);

srand(seed);

rial = 1 + rand() % 999;


return rial;
}


void coin_changer (int &, int &, int &, int &, int &); //function prototype for call by refrence


int main()
{

	int rial;
	int hund;
	int fift;
	int twent;
	int tens;
	int five;

cout<<"	enter the amount of money you have: "<< rial <<"coins"<<endl;

cout<<" \n";

coin_changer(hund, fift, twent, tens, five);

cout<< "the amount contains: \n";

cout<< hund <<" of  100 coins.\n";
cout<< fift <<"  of  50  coins.\n";
cout<< twent <<"  of  20  coins.\n";
cout<< tens <<" of  10  coins.\n";
cout<< five <<"  of  5  coins.\n";
cout<< endl;

return 0;
}


void coin_changer(int hund, int fift, int twent, int tens, int five )
{

	int rial;
	fift=0;
	twent=0;
	tens=0;
	five=0;
	int m,n;
	int f;


	hund=rial/100;

		m=rial%100;
		n=m/10;

		if (n = 5)
			fift=fift+1;

			else if (n= 2)
			twent=twent+1;

			else if (n =1 )
				tens=tens+1;

			
			f=m%10;

			if (f=5)
				five=five+1;


}
Last edited on
pleasse anyone ,
It might be because you forgot to post your question.
BTW: Your coin_changer declaraton and definition does not match.
it`s the same as one of my questions that i`ve posted,, i`ve already answered it you can check my post...

but still they want it for yew in rial,,,

so just change the code to rial!!:)
and the way you are calculating your coins is wrong ,,, you need to check that too...
Topic archived. No new replies allowed.