Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 1.2.cpp : This file contains the 'main' function. Program execution begins and ends there.
- //
- #include <iostream>
- #include <stdio.h>
- void General(unsigned &m,unsigned &x,unsigned &y,unsigned &w,unsigned &h) {
- int number, temp, Ox, Oy;
- bool testY, testX;
- printf_s("Write size of tile; coordinate x; coordinate y; width; hight: ");
- scanf_s("%i %i %i %i %i", &m, &x, &y, &w, &h);
- number = (x + w)*(y+h)/m;
- printf("%i", number);
- for (int i = 0; i < pow(10, 9) * 2; i += 10) {
- if (w == i) {
- //printf("\nDEBUG: i = %i", i);
- Ox = w;
- testX = 1;
- }
- else if (i != w && testX == 0){
- //printf("\nDEBUG: i = %i", i);
- Ox = (w / m + 1) * m;
- }
- if (i == h) {
- //printf("\nDEBUG: i = %i", i);
- Oy = h;
- testY = 1;
- }
- else if (i != h && testY == 0){
- //printf("\nDEBUG: i = %i", i);
- Oy = (h / m + 1) * m;
- }
- }
- for (int i = 0; i < pow(10, 9) * 2; i++) {
- if ((float)y / 10 != i && y != 0) {
- number = (Ox / m) * (Oy / m) + (Oy / m);
- break;
- }
- if ((float)x / 10 != i && x != 0) {
- number = (Ox / m) * (Oy / m) + (Ox / m);
- break;
- }
- else {
- number = (Ox / m) * (Oy / m);
- break;
- }
- }
- printf("\nLatest left side tile has coordinate Ox: %i\nLatest left tile has coordinate Oy: %i\nNumbers of tile: %i", Ox, Oy, number);
- }
- int main() {
- unsigned m, x, y, w, h;
- General(m, x, y, w, h);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement