Advertisement
Guest User

Untitled

a guest
May 30th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. //Steven Lay
  2. //24/05/2017
  3.  
  4. #include <stdlib.h>
  5. #include <stdio.h>
  6.  
  7. #define MAX_LENGTH 25
  8.  
  9. typedef struct tiles Tile;
  10.  
  11. struct tiles {
  12. int chara;
  13. int numba;
  14. };
  15.  
  16. void printTiles(Tile tiles[], int n);
  17. void printTile(Tile x);
  18.  
  19. int main(void){
  20. int characters[MAX_LENGTH];
  21. int numbers [MAX_LENGTH];
  22. int i = 0;
  23. Tile tiles[MAX_LENGTH];
  24. printf("Enter 25 tiles: Tiles:");
  25. while(i < MAX_LENGTH){
  26. characters[i] = getchar();
  27. getchar();
  28. numbers[i] = getchar();
  29. getchar();
  30. i++;
  31. }
  32. i = 0;
  33. while(i < MAX_LENGTH){
  34. printf("%c/%c", characters[i], numbers[i]);
  35. printf(" ");
  36. i++;
  37. }
  38. printf("Enter row and column for each tile ...\n");
  39.  
  40. printTiles(tiles,MAX_LENGTH);
  41. return 0;
  42. }
  43. void printTiles(Tile tiles[], int n){
  44. int i = 0;
  45. while ( i < n ){
  46. printTile(tiles[i]);
  47. i = i + 1;
  48. }
  49. }
  50.  
  51. void printTile(Tile x){
  52. printf("%c/%c ",x.chara,x.numba);
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement