Referring to this job requirements [ https://edu.cnblogs.com/campus/nenu/2019fall/homework/6582 ]
1. familiar with the command line and console
Please develop applications in C d.exe, read commands from the console command line parameters, respectively, and print out the value of a, b, c in the console. Run the following example the effect of the form (6 points)
Reminder: Please note that the following code sample, and in the same line, no line breaks. ">" Prompt is called, is part of the operating system, not the output of your program.d.exe
a=1 b=2 c=3
>d.exe a=1 b=2 c=3
1
2
3 >d.exe a=11 b=22 c=33 11 22 33
代码如下:
#include<stdio.h> //int argc,char *argv[],char *envp[] int main(int argc,char *argv[]){ int i=1; for(;i<argc;i++){ char* str = argv[i]; while(*str!='=') str+=1; str+=1; printf("%s\n",str); } return 0; }
命令行执行结果如下: