求一个c语言参数传递的实例

写一个c程序,gcc编译成可执行程序名字为test
开始运行程序
./test 输出 “你可以输入 ./test -a 3 运行此程序”
然后
./test -a 3 输出结果是test1
./test -b 4 输出结果是test2

#include
#include
#include

int main(int argc, char **argv)
{

switch (argc)
{
    case 3:
        if (!strcmp(argv[1], "-a") && (!strcmp(argv[2], "3")))
        {
            printf("\n\rtest1");
        }
        else if (!strcmp(argv[1], "-b") && (!strcmp(argv[2], "4")))
        {
            printf("\n\rtest2");
        }
        else
        {
            printf("\n\r你可以输入 ./test -a 3 运行此程序");
        }
        break;
    default:
        printf("\n\r你可以输入 ./test -a 3 运行此程序");
        break;

}

printf("\n\r");

return 0;

}