Void Function Error

I have made three functions. I have yet to make more functions. On selectseries function, I have entered the parameter as Enterchoice. Not sure if that is correct, but can someone check it to make sure if its correct. Later On, in my main function, I have use the select series function, but im getting an error on Enteroption function insice the parenthesis. May I know whats wrong?

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
100
101
  //Function will prompt the user to enter the option they want the computer to read
int EnterOption()
{

	//Display all the choices
	//The counter is set to 1. Printing out the text in a quicker way. Displaying text on screen.
	int counter=1;
	while(counter<=9)
	{
		cout<<"\n\n\t" <<counter<< ".] Print all the numbers between 1 and 1000 that are divisible by "<< counter;
	counter++;
	}

	//Display the other three options
	cout<<"\n\n\t10.] Print all the numbers between one and thousand";
	cout<<"\n\n\t11.] Print all the even numbers between one and thousand";
	cout<<"\n\n\t12.] Print all the odd numbers between one and thousand";

	//Declare variable for number that will store the user option
	int number;

	//Prompt user to enter option and enter number
	cout<< "\n\nEnter Option: ";
	cin>>number;

	//If the user enters in zero, Exit the program
	if (number==0)
	{
		cout<<"\n\nProgram Will Terminate";
		_getch();
		return 0;
	
	}
	//if the user enters the wrong number, it will ask again
	while (number <1 || number >12)
	{
		cout<<"\nInvalid Entry";
		cout<<"\n\nEnter Valid Option: ";
		cin>>number;
	
	
	}
	return number;
}

//Function will print out the number that is divisible
void print_series1(int divisible)
{
	//Making a variable that will divide the divisble number by each number to 1000
	int counter;
	int remainder;
	counter=1;
	cout<<endl;

	//While counter is less then 1000 it will print out the divisible numbers
	while (counter<=1000)
	{
		//formula for finding the remainder
		remainder=counter%divisible;

		//If remainder=0, the print out the divisible number
		if (remainder==0)
		{
			cout<<counter;
			cout<< " ";
		
		}
	counter++;
	
	}



}

//Function where the uuser choice will tell what series to use
//EnterOption is use to see what value will be inputed here in this parameter. If its one it will use a certain formula
void selectseries (int EnterOption())
{
	//If the Enteroptions returns a value of one, you will use powersereies 1 function
	if (EnterOption()==1)
	{
		print_series1(EnterOption());
	
	}

}

	
	

int _tmain(int argc, _TCHAR* argv[])
{
	EnterOption();
	selectseries( EnterOption());
	_getch();
	return 0;
}


it really makes no sense to have int EnterOption() as a parameter for selectseries. Just remove it
Can I not use it though? I'm going to solve that function inside the parameter. Suppose, the fuction will return a value of one. So selectseries would become (selectseries(1))
Can I not use it though?
sure you can. similar to print_series1:
1
2
3
4
5
6
7
8
9
10
void selectseries (int option)
{
	//If the Enteroptions returns a value of one, you will use powersereies 1 function
	if (option==1)
	{
		print_series1(option);
	
	}

}
I don't think that you wanted to call EnterOption() twice?
Topic archived. No new replies allowed.