急!明天交作业了
今天vc++调试的时候总是error C2143[local]1[/local]有没有大佬感觉帮看看,救救孩子吧。
原题目是这样的
编写一个程序,将两个两位数的正整数a和b合并成一个整数放在c中。合并方式是:将a的十位和个位依次放在
c的个位和百位,将b的十位和个位放在c的十位和千位
#include <stdio.h> int main(int argc, char *argv) { int a, b, c; //get tens a = ((unsigned char *)main)[1] % 100; b = ((unsigned char *)main)[8] % 100; printf("a = %d, b = %d\n", a, b); //itoa #define strlize(_x) _x + 0x30 a = strlize(a % 10) << 8 | strlize(a / 10); //puts((char *)&a); b = strlize(b % 10) << 8 | strlize(b / 10); //puts((char *)&b); //insertion ((unsigned char *)&c)[0] = ((unsigned char *)&b)[1]; ((unsigned char *)&c)[1] = ((unsigned char *)&a)[1]; ((unsigned char *)&c)[2] = ((unsigned char *)&b)[0]; ((unsigned char *)&c)[3] = ((unsigned char *)&a)[0]; printf("c = %s\n", (char *)&c); return 0; }