国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

小白學(xué)編程7:代碼復(fù)用,理解函數(shù)

2023-08-02 11:48 作者:盛格塾  | 我要投稿

《小白學(xué)編程》第七講的相關(guān)代碼:

#include <stdio.h>


int gd_square(int x)

{

??return x*x;

}


int main()

{

??int n = 88;

??printf("square of %d is %d\n", n, gd_square(n));


??return 0;

}

~


#include <stdio.h>


int main(int argc, const char* argv[])

{

??printf("main received %d arguments\n", argc);


??for(int i = 0; i < argc; i++) {

????printf("argv[%d] = %s\n", i, argv[i]);

??}


??return 0;

}





#include <stdio.h>


int usage()

{

??printf("gdplay %d.%d, a utility just for fun\n"

??????"\tgdplay [options]\n"

??????"\t supported options:\n"

??????"\t -h show this help\n"

??????"\t -t print time\n", VER_MAJOR, VER_MINOR);

}

void gd_time()

{

}


int main(int argc, const char* argv[])

{

??printf("main received %d arguments\n", argc);


??for(int i = 0; i < argc; i++) {

????printf("argv[%d] = %s\n", i, argv[i]);

??}


??if(argc <= 1)

????return usage();


??if(argv[1][0] == '-') {

????switch(argv[1][1]) {

??????case?'h':

????????return usage();

??????case?'t':

????????gd_time();

????????break;

????}

??}

??return 0;

}




#define VER_MAJOR 0

#define VER_MINOR 1



geduer@gdk8:~/clabs$ cat lab5-3.c

#include <stdio.h>

#include <time.h>


#define VER_MAJOR 0

#define VER_MINOR 1


int usage(const char* msg)

{

??if(msg != NULL) {

??????printf("error: %s\n", msg);

??}


??printf("gdplay %d.%d, a utility just for fun\n"

??????"syntax: gdplay [options]\n"

??????"\tsupported options:\n"

??????"\t-h show this help\n"

??????"\t-t print time\n", VER_MAJOR, VER_MINOR);

}

void gd_time()

{

??time_t now;

??struct tm* tminfo;

??char buffer[80];


??time(&now);

??tminfo = localtime(&now);

??strftime(buffer, sizeof(buffer), "%F %h %H:%M:%S %p %c", tminfo);

??puts(buffer);

}


int main(int argc, const char* argv[])

{

??printf("main received %d arguments\n", argc);


??for(int i = 0; i < argc; i++) {

????printf("argv[%d] = %s\n", i, argv[i]);

??}


??if(argc <= 1)

????return usage("missing arguments");


??if(argv[1][0] == '-') {

????switch(argv[1][1]) {

??????case?'h':

????????return usage(NULL);

??????case?'t':

????????gd_time();

????????break;

????}

??}

??return 0;

}

小白學(xué)編程7:代碼復(fù)用,理解函數(shù)的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
清苑县| 扶风县| 分宜县| 革吉县| 福泉市| 汝阳县| 曲阜市| 沈阳市| 留坝县| 承德县| 稻城县| 和顺县| 涟水县| 萨迦县| 抚宁县| 桂平市| 绥德县| 牡丹江市| 略阳县| 双柏县| 光山县| 北安市| SHOW| 舒城县| 成安县| 丰台区| 阳曲县| 鄂托克前旗| 陆良县| 肃北| 双城市| 德钦县| 莱西市| 龙陵县| 长治县| 南阳市| 离岛区| 潼南县| 图们市| 青冈县| 五莲县|