Jump to content
Fórum Script Brasil
  • 0

Dados do ficheiro para um vector


gclassroom

Question

Olá! Estou tendo dificuldade com um trabalho de programação. Tenho definido uma estrutura PIECE com o seguinte formato:

typedef struct square{

char file;

char rank;

}SQUARE;

typedef struct pieces{

int state;

int type;

char color;

SQUARE square;

}PIECE;

tenho um vector PIECE v[32] e tenho um ficheiro com este código:

a;2;1;100;w/

b;2;1;100;w/

c;2;1;100;w/

d;2;1;100;w/

e;2;1;100;w/

f;2;1;100;w/

g;2;1;100;w/

h;2;1;100;w/

a;7;1;100;b/

b;7;1;100;b/

c;7;1;100;b/

d;7;1;100;b/

e;7;1;100;b/

f;7;1;100;b/

g;7;1;100;b/

h;7;1;100;b/

a;8;1;500;b/

h;8;1;500;b/

a;1;1;500;w/

h;1;1;500;w/

b;8;1;300;b/

g;8;1;300;b/

b;1;1;300;w/

g;1;1;300;w/

c;8;1;305;b/

f;8;1;305;b/

c;1;1;305;w/

f;1;1;305;w/

d;8;1;900;b/

d;1;1;900;w/

e;8;1;2000;b/

e;1;1;2000;w/

como faço para colocar em cada posição do vector uma linha, em que cada ; separa campos dentro da estrutura. Grato pela atenção :)

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152k
    • Total Posts
      651.5k
×
×
  • Create New...