Compile error

Hello guys,

I'm currently having problem to have a proper output.

I should have gotten names instead of their address.

Assume my text file content:
Y Joseph/Stephanie
N Robert

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
#include<iostream>
#include<fstream>
#include<string>

using namespace std;

class family
{
public:

	char member[10][256];
};

int main()
{
	fstream in;
	family fam;
	in.open("name.txt");
	char m_status,str[20];
	if (!in)
	{
		cout << "File not valid...\n";
	}
	while (!in.eof())
	{
		in >> m_status;
		for (int a = 0; a < 1; a++)
		{
			in >> fam.member[a];//this loop works however it prints out the address instead of name
		}

	}
	in.close();

	cout << m_status << endl;
	cout<<fam.member<<endl;



	system("pause");
	return 0;
}



N
00F5F07C


I was told to use strcpy(fam.member[0], str) but im still confused on these function.Can someone plz assist me.
Last edited on
> Error upon execution:IntelliSense: no operator ">>" matches these operands
¿what? that's a compile error, ¿why does it say execution?


> this loop works however it prints out the address instead of name
¿what address? there is no address in your input file.
you aren't printing anything in your code either.
isnt member[10][256] an array pointer?

i have updated my post
cout<<fam.member[0]<<endl;
Topic archived. No new replies allowed.