KanAkira 20190912-2 command line

This job requires 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

 code show as below:

#include <stdio.h>
 int main ( int argc, char * the argv []) {
     char A, B, C;
      // sscanf (): String formatted output, corresponding to strcpy 
    sscanf (the argv [ . 1 ], " A =% C " , & A ); 
    sscanf (the argv [ 2 ], " B =% C " , & B); 
    sscanf (the argv [ . 3 ], " C =% C " , & C); 
    the printf ( " \ n- C% \ n-\% n-C \ n-\% n-C \ n-\ n- " , A, B, C);
     return  0 ; 
}

FIG operating results as follows:

Guess you like

Origin www.cnblogs.com/kangzhe-nenu/p/11515336.html