Returning a value.

If you return 1 in this code, doesn't readinputrecord = 1?


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 int ReadInputRecord(int &num1, int &num2, int &num3, int &num4, int &num5, int &num6, string &team, ifstream &rawdata)
	{
		while (rawdata >> num1)
		{
			rawdata >> num2;
			rawdata >> num3;
			rawdata >> num4;
			rawdata >> num5;
			rawdata >> num6;
			rawdata >> team;
			return(1);
		}
			return(0);
		}

Why cant I use this?
1
2
3
4
5
6
7
8
ReadInputRecord(num1, num2, num3, num4, num5, num6, team, rawdata);
	if (ReadInputRecord == 1)
	{
		num1 = Math(num1, num4);
		num2 = Math(num2, num5);
		num3 = Math(num3, num6);
		SecondsSum = num1 + num2 + num3;
	}


I have also tried this,

if (ReadInputRecord(num1, num2, num3, num4, num5, num6, team, rawdata) == 1)

Without the results I wanted, am I doing it completely wrong?
Last edited on
that isn't right.

you want something like:

1
2
3
4
5
6
7
8
9
10
         int result = ReadInputRecord(num1, num2, num3, num4, num5, num6, team, rawdata);

	if (result == 1)
	{
		num1 = Math(num1, num4);
		num2 = Math(num2, num5);
		num3 = Math(num3, num6);
		SecondsSum = num1 + num2 + num3;
	}

or
1
2
3
4
5
6
7
8
	if ( ReadInputRecord(num1, num2, num3, num4, num5, num6, team, rawdata))
	{
		num1 = Math(num1, num4);
		num2 = Math(num2, num5);
		num3 = Math(num3, num6);
		SecondsSum = num1 + num2 + num3;
	}
Last edited on
Yeah, thank you, I should have waited and looked at it more, thanks agian.
Topic archived. No new replies allowed.