第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

作業(yè)社區(qū)

探索學(xué)習(xí)新天地,共享知識(shí)資源!

0 提交作業(yè)
0個(gè) 布置作業(yè)
0 滿(mǎn)分作業(yè)
得分 100
學(xué)習(xí)任務(wù)
得分 100
學(xué)習(xí)任務(wù)

蠟筆小方哎 的學(xué)生作業(yè):

讀端,通過(guò)select監(jiān)聽(tīng)有名管道: #include #include #include #include #include #include #include #include #define FIFO_PATH "./test_fifo" int main() { int fd, ret; fd_set read_fds, read_fds_tmp; struct timeval tv, tv_tmp; tv.tv_sec = 1; tv.tv_usec = 0; if(mkfifo(FIFO_PATH, 0644) == -1) { perror("mkfifo() error!\n"); exit(-1); } fd = open(FIFO_PATH, O_RDONLY); if(-1 == fd) { perror("open() error!\n"); exit(-1); } FD_ZERO(&read_fds); FD_SET(fd, &read_fds); char buf[20]; while(1) { read_fds_tmp = read_fds; tv_tmp = tv; memset(buf, 0, sizeof(buf)); ret = select(fd+1, &read_fds_tmp, NULL, NULL, &tv_tmp); if(ret > 0) { if(FD_ISSET(fd, &read_fds_tmp)) { read(fd, buf, sizeof(buf)); if(strcmp(buf, "quit") == 0) break; printf("recv: %s\n", buf); } } } close(fd); return 0; } 寫(xiě)端,最后通過(guò)unlink刪除有名管道: #include #include #include #include #include #include #include #define FIFO_PATH "./test_fifo" int main() { int fd; fd = open(FIFO_PATH, O_WRONLY); if(-1 == fd) { perror("open() error!\n"); exit(-1); } char buf[20]; while(1) { memset(buf, 0, sizeof(buf)); fgets(buf, sizeof(buf), stdin); buf[strlen(buf)-1] = '\0'; printf("[DEBUG] input buf = %s\n", buf); write(fd, buf, strlen(buf)); if(strcmp(buf, "quit") == 0) { sleep(1); break; } } close(fd); unlink(FIFO_PATH); return 0; }

得分 100
學(xué)習(xí)任務(wù)

qq_康斯坦丁_0 的學(xué)生作業(yè):

#include // 定義學(xué)生結(jié)構(gòu)體 typedef struct { char name[20]; int id; int score; } s_t; // 輸入學(xué)生信息的函數(shù) void input_student(s_t s[], int n) { for (int i = 0; i < n; i++) { printf(“請(qǐng)輸入第 %d 個(gè)學(xué)生的姓名: “, i + 1); scanf(”%s”, s[i].name); printf(“請(qǐng)輸入第 %d 個(gè)學(xué)生的 ID: “, i + 1); scanf(”%d”, &s[i].id); printf(“請(qǐng)輸入第 %d 個(gè)學(xué)生的分?jǐn)?shù): “, i + 1); scanf(”%d”, &s[i].score); } } // 輸出學(xué)生信息的函數(shù) void output_student(s_t s[], int n) { for (int i = 0; i < n; i++) { printf(“姓名: %s, ID: %d, 分?jǐn)?shù): %d\n”, s[i].name, s[i].id, s[i].score); } } // 返回分?jǐn)?shù)最高學(xué)生信息的函數(shù) s_t maxscore_student(s_t s[], int n) { s_t max = s[0]; for (int i = 1; i < n; i++) { if (s[i].score > max.score) { max = s[i]; } } return max; } int main() { s_t s[3]; // 調(diào)用輸入函數(shù) input_student(s, 3); // 調(diào)用輸出函數(shù) printf("輸入的學(xué)生信息如下:\n"); output_student(s, 3); // 調(diào)用查找最高分學(xué)生信息的函數(shù) s_t max_student = maxscore_student(s, 3); printf("分?jǐn)?shù)最高的學(xué)生信息:姓名: %s, ID: %d, 分?jǐn)?shù): %d\n", max_student.name, max_student.id, max_student.score); return 0; }

微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)