PDA

View Full Version : Macro



comlink21
25th July 2007, 02:33
hi there,
pls teach me how to assign macro in qt4,

let say i have the following data:

num_1 = 500;
num_2 = 340;
num_3 = 300;
num_4 = 600;
num_5 = 700;

then i want to trace each number (num_?) value using macro.
last time when i use Foxpro to display number is like this:
k = 1
do while (k <=4)
str = str(k)
@10+k,5 say num_&str <--- using '&'
enddo

does qt4 has such macro methode..?

thank for help.
Regard
comlink21

jpn
25th July 2007, 11:28
This doesn't actually have anything to do with Qt. Qt is just a C++ library. However, here's one way to do it in C++:


int num[5];
num[0] = 500;
num[1] = 340;
num[2] = 300;
num[3] = 600;
num[4] = 700;

for (int i = 0; i < 5; ++i)
std::cout << num[i] << std::endl;