struct sCell { int x,y,px,py; int type; float cx, cy; // przechowują konkretną wartość } sCell cells[4096]; main() { .... loop { ... float cx = cells[index].cx; float cy = cells[index].cy; ... } ... }
float numbers[40][2] = { {1.0f, 0.0f}, {1.0f, 0.1f}, {1.0f, 0.2f}, .... {0.4f, 1.0} } struct sCell { int x,y,px,py; int type; int cx, cy; // przechowują index do tablicy gdzie znajduje się wartosc } sCell cells[4096]; main() { .... loop { ... float cx = numbers[cells[index].cx][0]; float cy = numbers[cells[index].cy][1]; ... } ... }
@mateusz_s, post #1
@mateusz_s, post #1
@mateusz_s, post #1
#include <stdio.h> float numbers[4][2] = { {1.0f, 0.0f}, {1.0f, 0.1f}, {1.0f, 0.2f}, {0.4f, 1.0} }; float numbers1[4] = { 1.0f, 1.0f, 1.0f, 0.4f}; struct sCell { int x,y,px,py; int type; int cx, cy, cz, c1; // przechowują index do tablicy gdzie znajduje się wartosc }; struct sCell cells[4096]; int main() { int index; float cx, cy, cz, c1; while(1) { cz = numbers1[cells[index].cz]; c1 = numbers1[cells[index].c1]; printf("%d", (int) (cz + c1)); cx = numbers[cells[index].cx][0]; cy = numbers[cells[index].cy][1]; printf("%d", (int) (cx + cy)); }; }
#include <stdio.h> float numbers[4][2] = { {1.0f, 0.0f}, {1.0f, 0.1f}, {1.0f, 0.2f}, {0.4f, 1.0} }; float numbers1[4] = { 1.0f, 1.0f, 1.0f, 0.4f}; struct sCell { int x,y,px,py; int type; int cx, cy, cz, c1; // przechowują index do tablicy gdzie znajduje się wartosc }; struct sCell cells[4096]; int main() { int index; int i = 0; float cx, cy, cz, c1; while(1) { if(i) i = 0; else i = 1; cz = numbers1[cells[index].cz]; c1 = numbers1[cells[index].c1]; printf("%d", (int) (cz + c1)); cx = numbers[cells[index].cx][i]; cy = numbers[cells[index].cy][i]; printf("%d", (int) (cx + cy)); }; }
@WyciorX, post #5
float cx = cells[index].cx; float cy = cells[index].cy;czy
float cx = numbers[cells[index].cx][0]; float cy = numbers[cells[index].cy][1];
cx = numbers[cells[index].cx][0]; cy = numbers[cells[index].cy][1];z
cx = numbers[cells[index].cx][i]; cy = numbers[cells[index].cy][i]; gdzie i=1 lub 0
@docent, post #7
@docent, post #7
#include <stdio.h>
float numbers[4][2] = { {1.0f, 0.0f}, {1.0f, 0.1f}, {1.0f, 0.2f}, {0.4f, 1.0} };
float numbers1[4] = { 1.0f, 1.0f, 1.0f, 0.4f};
struct sCell
{
int x,y,px,py;
int type;
int cx, cy, cz, c1; // przechowują index do tablicy gdzie znajduje się wartosc
};
struct sCell cells[4096];
int main()
{
int index;
float cx, cy, cz, c1;
while(1)
{
cz = numbers1[cells[index].cz];
c1 = numbers1[cells[index].c1];
printf("%d", (int) (cz + c1));
index++;
cx = numbers[cells[index].cx][0];
cy = numbers[cells[index].cy][1];
printf("%d", (int) (cx + cy));
index++;
};
}