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