Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Steven Lay
- //24/05/2017
- #include <stdlib.h>
- #include <stdio.h>
- #define MAX_LENGTH 25
- typedef struct tiles Tile;
- struct tiles {
- int chara;
- int numba;
- };
- void printTiles(Tile tiles[], int n);
- void printTile(Tile x);
- int main(void){
- int characters[MAX_LENGTH];
- int numbers [MAX_LENGTH];
- int i = 0;
- Tile tiles[MAX_LENGTH];
- printf("Enter 25 tiles: Tiles:");
- while(i < MAX_LENGTH){
- characters[i] = getchar();
- getchar();
- numbers[i] = getchar();
- getchar();
- i++;
- }
- i = 0;
- while(i < MAX_LENGTH){
- printf("%c/%c", characters[i], numbers[i]);
- printf(" ");
- i++;
- }
- printf("Enter row and column for each tile ...\n");
- printTiles(tiles,MAX_LENGTH);
- return 0;
- }
- void printTiles(Tile tiles[], int n){
- int i = 0;
- while ( i < n ){
- printTile(tiles[i]);
- i = i + 1;
- }
- }
- void printTile(Tile x){
- printf("%c/%c ",x.chara,x.numba);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement