第1页共88页编号:时间:2021年x月x日书山有路勤为径,学海无涯苦作舟页码:第1页共88页1、请定义一个宏,比较两个数a、b的大小,不能使用大于、小于、if语句2、如何输出源文件的标题和目前执行行的行数3、两个数相乘,小数点后位数没有限制,请写一个高精度算法4、写一个病毒5、有A、B、C、D四个人,要在夜里过一座桥。他们通过这座桥分别需要耗时1、2、5、10分钟,只有一支手电,并且同时最多只能两个人一起过桥。请问,如何安排,能够在17分钟内这四个人都过桥?1.请定义一个宏,比较两个数a、b的大小,不能使用大于、小于、if语句//这样转向定义应该不算违规吧!^_^#defineCmp(x,y)compare(x,y)intcompare(inta,intb){a^=(1<<31);b^=(1<<31);inti=31;while((i^-1)&&!((a&(1<>i)&1)?1:-1):0;}#defineCOMPARE(a,b)((a)-(b))//<0:a0:a>b2.如何输出源文件的标题和目前执行行的行数cout<<"Filename"<<__FILE__<<"Line"<<__LINE__<usingnamespacestd;第2页共88页第1页共88页编号:时间:2021年x月x日书山有路勤为径,学海无涯苦作舟页码:第2页共88页#defineMAX10000structNode{intdata;Node*next;};voidoutput(Node*head){if(!head->next&&!head->data)return;output(head->next);cout<data;}voidMul(char*a,char*b,intpos){char*ap=a,*bp=b;Node*head=0;head=newNode;head->data=0,head->next=0;//头Node*p,*q=head,*p1;inttemp=0,temp1,bbit;while(*bp)//若乘数不为空,继续.{p=q->next;p1=q;bbit=*bp-48;//把当前位转为整型while(*ap||temp)//若被乘数不空,继续{if(!p)//若要操作的结点为空,申请之{p=newNode;p->data=0;p->next=0;p1->next=p;}if(*ap==0)temp1=temp;else{temp1=(p1->data)+(*ap-48)*bbit+temp;ap++;}p1->data=temp1%10;//留当前位temp=temp1/10;//进位以int的形式留下.p1=p;p=p->next;//被乘数到下一位}ap=a;bp++;q=q->next;//q进下一位}p=head;output(p);//显示cout<next;deletehead;head=p;}}intmain(){cout<<"请输入两个数"<usingnamespacestd;#defineMAX10000structNode{intdata;Node*next;};voidoutput(Node*head,intpos){if(!head->next&&!head->data)return;output(head->next,pos-1);cout<data;if(!pos)cout<<".";}voidMul(char*a,char*b,intpos){char*ap=a,*bp=b;Node*head=0;head=newNode;head->data=0,head->next=0;//头Node*p,*q=head,*p1;inttemp=0,temp1,bbit;while(*bp)//若乘数不为空,继续.{p=q->next;p1=q;bbit=*bp-48;//把当前位转为整型while(*ap||temp)//若被乘数不空,继续第4页共88页第3页共88页编号:时间:2021年x月x日书山有路勤为径,学海无涯苦作舟页码:第4页共88页{if(!p)//若要操作的结点为空,申请之{p=newNode;p->data=0;p->next=0;p1->next=p;}if(*ap==0)temp1=temp;else{temp1=(p1->data)+(*ap-48)*bbit+temp;ap++;}p1->data=temp1%10;//留当前位temp=temp1/10;//进位以int的形式留下.p1=p;p=p->next;//被乘数到下一位}ap=a;bp++;q=q->next;//q进下一位}p=head;outpu...