8.3 作业
- 整理思维导图
2. 递归实现,输入一个数,输出这个数的每一位
#include <myhead.h>
void fun(int t)
{if(t == 0) return;fun(t/10);printf("%d\n",t%10);
}
int main(int argc,const char *argv[])
{int t=1623809; fun(t);return 0;
}
3.递归实现,输入一个数,输出这个数的二进制
#include <myhead.h>
void fun(int t)
{if(t == 0) return;fun(t/2);printf("%d",t%2);
}
int main(int argc,const char *argv[])
{int t=1623809; fun(t);putchar(10);return 0;
}
4.写一个脚本,包含以下内容:
- 显示/etc/group文件中第五行的内容
- 创建目录/home/ubuntu/copy
- 切换工作路径到此目录
- 赋值/etc/shadow到此目录,并重命名为test
- 将当前目录中test的所属用户改为root
- 将test中其他用户的权限改为没有任何权限
#!/bin/bashhead -5 /etc/group|tail -1
mkdir ~/copy
cd ~/copy
sudo cp /etc/shadow ./test
sudo chown root test
sudo chmod o= test