1
#include <cstdlib>
#include <iostream>
using namespace std;
#define Max(a,b) (a/b)? a : b
int main(int argc, char *argv[])
{
int a = 6;
int b = 7;
int max_num = 0;
int max = Max(a,b);
int const shift = sizeof(int)*8-1;
unsigned mask = (0x1<<shift);
if( (a-b)& mask)
{
max_num = b;
}
else
{
max_num = a;
}
cout<<max_num<<endl;
cout<<max<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
不用大于,小于号 用宏定义等
2
#include<stdio.h>
void main()
{
printf("%s\n",__FILE__); //文件名称
printf("%d\n",__LINE__); //有几行程序
}
__FILE__两个下划线 记住啊