can someone please tell me how functions work??

i am teaching myself c++ and i thought that when i pass an argument to a function it supposed to use it. but his one says "salary was not declared in this scope" what????

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


void qualify(){
	cout << "congratulations you qualify!! our card comes with a 12% annual interes fee." << endl;
}
 
 void noQualify();		// function prototype
 
int main()
{
 double salary;
 int years;
 
 
 cout << "This program will determine if you qualify\n";
 cout << "for out cridit card.\n";
 cout << "what is your annual salary? ";
 cin >> salary;
 cout << "How many years have you worked at your ";
 cout << "current job? ";
 cin >> years;
 if (salary  >= 17000.0 && years >= 2)
 	qualify();
  else
  	noQualify(salary);
  return 0;
}
 
 void noQualify(){
 	if (salary < 17000.0)
 		cout << "your salary isnt enough to meet our minimum requierments." << endl;
 	else
 		cout << "you dont have the experiance in your work area to meet our minimum requierments." << endl;
 }
nvm ignore me, i figured it out
Topic archived. No new replies allowed.