Need help, super frustrated!

So for homework we need to write a program:

Read a series of integers and determine the following information about each integer:

a. Is it a multiple of 7, 11 or 13? one function
b. Is the sum of the digits odd or even? one function
c. What is the square root value (if positive)? one function
d. Is it a prime number? one function

You should have at least four functions and label all output.
Use the following sample input data:

104
3773
13
121
77
30751

Currently when I try to debug, all I get is the last line in my my txt file and get output all the "else's" of my results. This is my output file:

"30751
It is not a multiple of 7, 11 or 13.
the sum of the digits is odd.
Cannot square root this number.
It is not a prime number."

Thanks in advance.

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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#include <fstream>
#include <conio.h>
#include <cmath>
using namespace std;
#define in_file "data.txt"
#define out_file "result.txt"
ifstream ins;
ofstream outs; 
int number, a, b, d, sqroot, sumofdigits, composite;
void multiple();
void digitsum();
void squareroot();
void primenumber();
void output();

void main()
{
	ins.open(in_file); 
	outs.open(out_file);
	int number, a, b, d, sqroot, sumofdigits, composite;
	ins >> number;
	multiple();
	digitsum();
	squareroot();
	primenumber();
	output();
	ins.close ();
	outs.close ();
	getch();
}

void multiple()
{
	int number, a;
	ins >> number;
	if ((number % 7 == 0) || (number % 11 == 0) || (number % 13 == 0))
	{
		a = 1;
	}
	else
	{
		a = 0;
	}
}

void digitsum()
{
	int number, sum = 0;
	ins >> number;
	while (number > 0)
	{
		sum = sum + (number % 10);
		number = number / 10;
	}
	if (sum % 2 == 0)
	{
		b == 1;
	}
	else
	{
		b == 0;
	}
}

void squareroot()
{
	int number;
	ins >> number;
	if (number > 0)
	{
		double sqroot = sqrt ((double) number);
	}
	else
	{
		sqroot == 0;
	}
}

void primenumber()
{
	int number, count = 0;
	ins >> number;
	for (int divisor = 2; divisor < number; divisor++)
	{
		if (number % divisor == 0)
		{
			count++;
		}
	}
	if (count == 0)
	{
		d == 1;
	}
	else
	{
		d == 0;
	}
}

void output()
{
	ins >> number;
	outs << number << endl;
	if (a == 1)
	{
		outs << "It is a multiple of 7, 11 or 13." << endl;
	}
	else
	{
		outs << "It is not a multiple of 7, 11 or 13." << endl;
	}
	if (b == 1)
	{
		outs << "The sum of the digits is even." << endl;
	}
	else
	{
		outs << "the sum of the digits is odd." << endl;
	}
	if (sqroot != 0)
	{
		outs << "The square root is: " << sqroot << endl;
	}
	else
	{
		outs << "Cannot square root this number." << endl;
	}
	if (d == 1)
	{
		outs << "It is a prime number." << endl;
	}
	else
	{
		outs << "It is not a prime number." << endl;
	}
	outs << endl;

}
Do not use global variables. Pass parameters and return value. For example:
1
2
// return true, if candidate is a prime number
bool primenumber( int candidate );
example for multiple
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
#include <fstream>
using namespace std;	

bool multiple(int number)
{
	if ((number % 7 == 0) || (number % 11 == 0) || (number % 13 == 0))	
		return true;	
	else return false;
}


int main()
{
	ifstream ins;
	ofstream outs;

	ins.open("inf.txt"); 
	outs.open("outf.txt");
	
	int number;
	while(ins >> number)
	{
		outs << number << endl;
		if( multiple(number) )
			outs << "is divisible by 7, 11 or 13\n";
		else
			outs << "is not divisible by 7, 11 or 13\n";	
	}
	
	ins.close ();
	outs.close ();
	
return 0;	
}
Is that the only way to do it? I don't know if my prof wants it like that. But if it is, thanks very very much.
If your prof doesn't want function parameters and return values, he should reconsider his choice of profession ;-) Sorry, I'm being polemic... but parameters and return value is *the only* way to do it right.
Topic archived. No new replies allowed.