Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. // 1.2.cpp : This file contains the 'main' function. Program execution begins and ends there.
  2. //
  3.  
  4. #include <iostream>
  5. #include <stdio.h>
  6.  
  7.  
  8.  
  9. void General(unsigned &m,unsigned &x,unsigned &y,unsigned &w,unsigned &h) {
  10. int number, temp, Ox, Oy;
  11. bool testY, testX;
  12. printf_s("Write size of tile; coordinate x; coordinate y; width; hight: ");
  13. scanf_s("%i %i %i %i %i", &m, &x, &y, &w, &h);
  14. number = (x + w)*(y+h)/m;
  15. printf("%i", number);
  16. for (int i = 0; i < pow(10, 9) * 2; i += 10) {
  17.  
  18. if (w == i) {
  19. //printf("\nDEBUG: i = %i", i);
  20. Ox = w;
  21. testX = 1;
  22. }
  23. else if (i != w && testX == 0){
  24. //printf("\nDEBUG: i = %i", i);
  25. Ox = (w / m + 1) * m;
  26. }
  27. if (i == h) {
  28. //printf("\nDEBUG: i = %i", i);
  29. Oy = h;
  30. testY = 1;
  31. }
  32. else if (i != h && testY == 0){
  33. //printf("\nDEBUG: i = %i", i);
  34. Oy = (h / m + 1) * m;
  35. }
  36. }
  37. for (int i = 0; i < pow(10, 9) * 2; i++) {
  38. if ((float)y / 10 != i && y != 0) {
  39. number = (Ox / m) * (Oy / m) + (Oy / m);
  40. break;
  41. }
  42. if ((float)x / 10 != i && x != 0) {
  43. number = (Ox / m) * (Oy / m) + (Ox / m);
  44. break;
  45. }
  46. else {
  47. number = (Ox / m) * (Oy / m);
  48. break;
  49. }
  50. }
  51.  
  52. printf("\nLatest left side tile has coordinate Ox: %i\nLatest left tile has coordinate Oy: %i\nNumbers of tile: %i", Ox, Oy, number);
  53. }
  54.  
  55. int main() {
  56. unsigned m, x, y, w, h;
  57. General(m, x, y, w, h);
  58. return 0;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement