Wang Xin Yao 20190912-2 Command Line

Requirements for this job see 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 main(int argc, char *argv[])
{
    int a,b,c;
    sscanf(argv[1],"a=%d",&a);
    sscanf(argv[2],"b=%d",&b);
    sscanf(argv[3],"c=%d",&c);
    printf("%d\n\n",a);
    printf("%d\n\n",b);
    printf("%d\n",c);
}

Screenshot:

 

Guess you like

Origin www.cnblogs.com/wxyao/p/11524373.html