📄 lab13.c
字号:
#include<stdio.h>
#include<string.h>
#include<fcntl.h>
main(int argc,char *argv[])
{
int pid,i,j;
char str[20][20],temp[20];
pid=fork();
if(pid==0)
{
printf("\n Child process");
for(i=0;i<argc-1;i++)
strcpy(str[i],argv[i+1]);
for(i=0;i<argc-1;i++)
for(j=i+1;j<argc;j++)
if((strcmp(str[i],str[j]))>0)
{
strcpy(temp,str[i]);
strcpy(str[i],str[j]);
strcpy(str[j],temp);
}
for(i=1;i<argc;i++)
printf("\n %s",str[i]);
}
else
{
wait(0);
printf("\n Parent Process");
for(i=1;i<argc;i++)
printf("\n %s",argv[i]);
}
}
~
~
~
~
~
~
~
~
~
~
~
19,3-24 All
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -