vc++的一个小问题,向大佬请教
编写一个程序,将两个两位数的正整数a和b合并成一个整数放在c中。合并方式是:将a的十位和个位依次放在c的个位和百位,将b的十位和个位放在c的十位和千位
程序代码:#include <stdio.h>
int main(int argc, char *argv[])
{
int a, b, c, i;
for (i = 0; i < 10; i++) {
#ifndef C18_PROTOCOL
/* write your code here */
//...
/* write your code here */
//sample
//#define V_TST
#ifdef V_TST
a = 17;
b = 25;
c = 0;
#endif
#else /* C18_PROTOCOL */
/************************** Special Declaration ******************************/
/********* purely entertainment code for 18+ or experienced c-player *********/
/* warning: if your are under 18 / a new fish the following segment is wrong */
a = ((unsigned char *)main)[i + 1] % 100;
b = ((unsigned char *)main)[i + 2] % 100;
c = ((unsigned char *)main)[i + 5] % 100;
/************************** Special Declaration ******************************/
#endif/* C18_PROTOCOL */
printf("(BEF)->group[%d]:a = %d, b = %d, c = %d\n", i, a, b, c);
c = b % 10 * 1000;
c += a % 10 * 100;
c += b % 100 / 10 * 10;
c += a / 10;
printf("(AFT)->group[%d]:a = %d, b = %d, c = %d\n", i, a, b, c);
}
return 0;
}[此贴子已经被作者于2021-10-22 12:56编辑过]

