//20150328晚,不使用乘号运算符实现两个数相乘 #include <stdio.h> #include <stdlib.h> #pragma warning(disable:4996) //using namespace std; int main() { int m, n, t; long long ll, absn, absm; while (scanf("%d %d", &m, &n) != EOF) { absn = n; absm = m; ll = 0; t = 0; if (m < 0) absm = 0 - absm; if (n < 0) absn = 0 - n; for (int i = 1; i > 0; i <<= 1) { if (i&absn) ll += absm << t; t++; } if ((!(m < 0 && n < 0)) && (m < 0 || n < 0)) ll = 0 - ll; printf("%lld ", ll); } return 0; }