计算机为什么用补码来表示二进制机器码

//递归函数的定义:一个直接调用自己或通过一系列的调用语句间接第调用自己的函数,称做递归函数。在程序设计语言中实现递归,是栈的一个重要应用。

//1.改变变量求结果;2.改变变量同时做对函数进行+,-,*,/求结果

/*

x=1              9
x/2-1=1  x=4     8
x/2-1=4  x=10    7
x/2-1=10 x=22    6
x/2-1=22 x=46    5
x/2-1=46 x=94    4
x/2-1=94 x=190   3
x/2-1=190 x=382  2
x/2-1=382 x=766  1

*/
/*
//#include"stdio.h"                //C语言头文件
#include<iostream.h>
int last(int n,int m){
 int c,m1=m+1;
 if(n==1)  c=1;
 else c=(last(n-1,m1)+1)*2;         

 //printf("day:%d total:%d\n",m1,c);                                                    //C语言
 cout<<"day:"<<m1<<ends<<"total:"<<c<<endl;
 return c;
}
void main(){

     // printf("total:%d\n",age(10,0));

     cout<<"total:"<<last(20,0)<<endl;

}

*/

posted @ 2019-11-11 15:47  博客_在线  阅读(161)  评论(0)    收藏  举报