Diffcult question
-
hi last week i attend one interview ,they asking one question in MFC . i have one txt file which is contains.... numbers 1 2 3 4 5 my question is how to sort in 3 digit form like this: 123 134 145 234 245 251 345 351 312 451 412 423 512 523 534 i need this kind of output in xml file . i need this kind of way ....i hav no idea abt how to get output.. thanks and regards Nisha
-
hi last week i attend one interview ,they asking one question in MFC . i have one txt file which is contains.... numbers 1 2 3 4 5 my question is how to sort in 3 digit form like this: 123 134 145 234 245 251 345 351 312 451 412 423 512 523 534 i need this kind of output in xml file . i need this kind of way ....i hav no idea abt how to get output.. thanks and regards Nisha
You can use something like this:
#define next(i) ((i) < 5 ? (i) + 1 : 1)
#define previous(i) ((i) > 1 ? (i) - 1 : 5)int main()
{
unsigned i, aux, j, cnt;for (i=1 ; i<6 ; i++) { for (aux = next(i) ; aux != previous(i) ; aux = next(aux)) { cout << i << aux << next(aux) << endl; } } return 0;
}
The "next" macro increments a value until it reaches 5. When such happens, it returns to 1. The "previous" macro does the opposite, when the value reaches 1 it returns to 5. regards
-
You can use something like this:
#define next(i) ((i) < 5 ? (i) + 1 : 1)
#define previous(i) ((i) > 1 ? (i) - 1 : 5)int main()
{
unsigned i, aux, j, cnt;for (i=1 ; i<6 ; i++) { for (aux = next(i) ; aux != previous(i) ; aux = next(aux)) { cout << i << aux << next(aux) << endl; } } return 0;
}
The "next" macro increments a value until it reaches 5. When such happens, it returns to 1. The "previous" macro does the opposite, when the value reaches 1 it returns to 5. regards
yes thanks ..but i want to this output into XML format...
-
yes thanks ..but i want to this output into XML format...
In what format? You can always output the XML tags with the values... I just don't know for sure which tags you intend on using. Regards Fratelli