No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
how can i put the filename get in scanf("%s", &filename); in fopen("filename.txt", "a"); [CODE=c] main() { FILE *file; . . . printf("type the filename (.txt): "); scanf("%s", &filename); file = fopen("filename.txt", "a"); fprintf(file, "..."); fclose(file); . . . } [/CODE] |
|
i'm trying to print the suits of the cards [CODE=c]typedef enum{diamonds, spades, hearts, clubs}SUIT; typedef struct{ SUIT suit; int value; }CARD; typedef struct{ CARD *cards[52]; int atual; /*indicates the next card to be withdrawal of the deck*/ }DECK; typedef struct{ char name[30]; CARD hand[3]; CARD biggest_card; int num_victories; }PLAYER; switch(suit) … |
|
how can i sort in decreasing order? i did the sort is in increasing order [CODE=c] typedef struct{ char name[30]; CARd hand[3]; CARd biggest_card; int nro_victories; }PLAYER; PLAYER h; int m, i, j, k; for(i=0; i<n_playeres-1; i++) { k = j; m = h[i].nro_victories; for(j=i+1; j<n_players; j++) { if(h[j].nro_victories < … |
|
i'm trying to do a biggest card game in c but i'm reciving some errors that i can't figure out please help me... the functions are separeted of the main(project) i'm receving the error 'incompatible types in assignment' in the function compare card [CODE=c] /*This function compares card1 with card2 … |