C Primer Plus第十一章编程练习答案

news2024/10/3 2:26:20

学完C语言之后,我就去阅读《C Primer Plus》这本经典的C语言书籍,对每一章的编程练习题都做了相关的解答,仅仅代表着我个人的解答思路,如有错误,请各位大佬帮忙点出!

1.设计并测试一个函数,从输入中获取下n个字符(包括空白、制表 符、换行符),把结果储存在一个数组里,它的地址被传递作为一个参数。

#include <stdio.h>
#define LEN 11
void getnchar(char str[], int n)
{
    for (int i = 0; i < n - 1; ++i)
    {
        str[i] = getchar();
    }
}
int main(int argc, char* argv[])
{
    char str[LEN] = { 0 };

    printf("Please enter %d characters:\n", LEN - 1);
    getnchar(str, LEN);
    printf("Result:\n");
    puts(str);
    printf("Done.\n");

    return 0;
}

2.修改并编程练习1的函数,在n个字符后停止,或在读到第1个空白、 制表符或换行符时停止,哪个先遇到哪个停止。不能只使用scanf()。

#include <stdio.h>
#include <ctype.h>
#define LEN 11
void getnchar(char str[], int n)
{
    int i = 0;
    while (i < n - 1)
    {
        str[i] = getchar();
        if (isspace(str[i]))
        {
            break;
        }
        ++i;
    }
}
int main(int argc, char* argv[])
{
    char str[LEN] = { 0 };

    printf("Please enter %d characters:\n", LEN - 1);
    getnchar(str, LEN);
    printf("Result:\n");
    puts(str);
    printf("Done.\n");

    return 0;
}

3.设计并测试一个函数,从一行输入中把一个单词读入一个数组中,并 丢弃输入行中的其余字符。该函数应该跳过第1个非空白字符前面的所有空 白。将一个单词定义为没有空白、制表符或换行符的字符序列。

#include <stdio.h>
#include <ctype.h>
#define LEN 10
char* getword(char* str)
{
    int ch;
    int n = 0;
    char* pt = str;

    while ((ch = getchar()) != EOF && isspace(ch))
        continue;

    if (ch == EOF)
    {
        return NULL;
    }
    else
    {
        n++;
        *str++ = ch;
    }
    while ((ch = getchar()) != EOF && !isspace(ch) && (n < LEN - 1))
    {
        *str++ = ch;
        n++;
    }
    *str = '\0';

    if (ch == EOF)
    {
        return NULL;
    }
    else
    {
        while (getchar() != '\n')
            continue;
        return pt;
    }
}
int main(int argc, char* argv[])
{
    char input[LEN] = { 0 };

    printf("Please enter a word (EOF to quit):\n");
    while (getword(input) != NULL)
    {
        printf("Result:\n");
        puts(input);
        printf("You can enter a word again (EOF to quit):\n");
    }
    printf("Done.\n");

    

4.设计并测试一个函数,它类似编程练习3的描述,只不过它接受第2个 参数指明可读取的最大字符数。

#include <stdio.h>
#include <ctype.h>
#define LEN 11
char* getword(char* str, int len)
{
    int ch;
    int n = 0;
    char* pt = str;

    while ((ch = getchar()) != EOF && isspace(ch))
        continue;

    if (ch == EOF)
    {
        return NULL;
    }
    else
    {
        n++;
        *str++ = ch;
    }
    while ((ch = getchar()) != EOF && !isspace(ch) && n < len)
    {
        *str++ = ch;
        n++;
    }
    *str = '\0';

    if (ch == EOF)
    {
        return NULL;
    }
    else
    {
        while (getchar() != '\n')
            continue;
        return pt;
    }
}

int main(int argc, char* argv[])
{
    char input[LEN];

    printf("Please enter a word (EOF to quit):\n");
    while (getword(input, LEN - 1) != NULL)
    {
        printf("Result:\n");
        puts(input);
        printf("You can enter a word again (EOF to quit):\n");
    }
    printf("Done.\n");

    return 0;
}

5.设计并测试一个函数,搜索第1个函数形参指定的字符串,在其中查 找第2个函数形参指定的字符首次出现的位置。如果成功,该函数返指向该 字符的指针,如果在字符串中未找到指定字符,则返回空指针(该函数的功 能与 strchr()函数相同)。在一个完整的程序中测试该函数,使用一个循环 给函数提供输入值。

#include <stdio.h>
#include <string.h>
#define LEN 20
char* mystrchr(char* str, char ch)
{
    while (*str)
    {
        if (*str == ch)
        {
            return str;
        }
        ++str;
    }
    return NULL;
}
char* s_gets(char* st, int n)
{
    char* ret_val;
    char* find;

    ret_val = fgets(st, n, stdin);
    if (ret_val)
    {
        find = strchr(st, '\n');
        if (find)
        {
            *find = '\0';
        }
        else
        {
            while (getchar() != '\n')
                continue;
        }
    }
    return ret_val;
}
int main(int argc, char* argv[])
{
    char ch, str[LEN];

    printf("Please enter a string (EOF to quit):\n");
    while (s_gets(str, LEN) != NULL)
    {
        printf("Please enter a character: ");
        ch = getchar();
        while (getchar() != '\n')
            continue;
        printf("String:\n");
        puts(str);
        if (mystrchr(str, ch) == NULL)
        {
            printf("Not exist %c in the string.\n", ch);
        }
        else
        {
            printf("Exist %c in the string.\n", ch);
        }
        printf("You can enter a string again (EOF to quit):\n");
    }
    printf("Done.\n");

    return 0;
}

6.编写一个名为is_within()的函数,接受一个字符和一个指向字符串的 指针作为两个函数形参。如果指定字符在字符串中,该函数返回一个非零值 (即为真)。否则,返回0(即为假)。在一个完整的程序中测试该函数, 使用一个循环给函数提供输入值。

#include <stdio.h>
#include <string.h>
#define LEN 20
char* s_gets(char* st, int n)
{
    char* ret_val;
    char* find;

    ret_val = fgets(st, n, stdin);
    if (ret_val)
    {
        find = strchr(st, '\n');
        if (find)
        {
            *find = '\0';
        }
        else
        {
            while (getchar() != '\n')
                continue;
        }
    }
    return ret_val;
}
int is_within(char ch, const char* str)
{
    while (*str)
    {
        if (*str == ch)
        {
            return 1;
        }
        ++str;
    }
    return 0;
}
int main(int argc, char* argv[])
{
    char ch, str[LEN];

    printf("Please enter a string (EOF to quit):\n");
    while (s_gets(str, LEN) != NULL)
    {
        printf("Please enter a character: ");
        ch = getchar();
        while (getchar() != '\n')
            continue;
        printf("String:\n");
        puts(str);
        if (!is_within(ch, str))
        {
            printf("Not exist %c in the string.\n", ch);
        }
        else
        {
            printf("Exist %c in the string.\n", ch);
        }
        printf("You can enter a string again (EOF to quit):\n");
    }
    printf("Done.\n");

    return 0;
}

7.strncpy(s1, s2, n)函数把s2中的n个字符拷贝至s1中,截断s2,或者有必 要的话在末尾添加空字符。如果s2的长度是n或多于n,目标字符串不能以空 字符结尾。该函数返回s1。自己编写一个这样的函数,名为mystrncpy()。在 一个完整的程序中测试该函数,使用一个循环给函数提供输入值。

#include <stdio.h>
#include <string.h>
#define LEN 11
void eatline(void)
{
    while (getchar() != '\n')
        continue;
    return;
}
char* s_gets(char* st, int n)
{
    char* ret_val;
    char* find;

    ret_val = fgets(st, n, stdin);
    if (ret_val)
    {
        find = strchr(st, '\n');
        if (find)
        {
            *find = '\0';
        }
        else
        {
            eatline();
        }
    }
    return ret_val;
}

char* mystrncpy(char* dest, char* src, int n)
{
    int count = 0;

    while (*src != '\0' && count < n)
    {
        *(dest + count) = *src++;
        count++;
    }
    *(dest + count) = '\0';
    return dest;
}int main(int argc, char* argv[])
{
    int len;
    char target[LEN];
    char source[LEN];

    printf("Please enter a string (EOF to quit):\n");
    while (s_gets(source, LEN) != NULL)
    {
        printf("Please enter a number for copy (> 0): ");
        while (scanf("%d", &len) != 1 || len <= 0)
        {
            eatline();
            printf("Please enter again: ");
        }
        eatline();
        printf("Source string: %s\n", source);
        printf("Target string: %s\n", mystrncpy(target, source, len));
        printf("You can enter a string again (EOF to quit):\n");
    }
    printf("Done.\n");

    return 0;
}

8.编写一个名为string_in()的函数,接受两个指向字符串的指针作为参 数。如果第2个字符串中包含第1个字符串,该函数将返回第1个字符串开始的地址。例如,string_in("hats", "at")将返回hats中a的地址。否则,该函数返 回空指针。在一个完整的程序中测试该函数,使用一个循环给函数提供输入 值。

#include <stdio.h>
#include <string.h>
#define LEN 11
char* s_gets(char* st, int n)
{
    char* ret_val;
    char* find;

    ret_val = fgets(st, n, stdin);
    if (ret_val)
    {
        find = strchr(st, '\n');
        if (find)
        {
            *find = '\0';
        }
        else
        {
            while (getchar() != '\n')
                continue;
        }
    }
    return ret_val;
}
char* string_in(char* str, char* pt)
{
    int i = 0, j = 0;
    int str_len = strlen(str), pt_len = strlen(pt);

    while (i < str_len && j < pt_len)
    {
        if (str[i] == pt[j])
        {
            i++;
            j++;
        }
        else
        {
            i = i - j + 1;
            j = 0;
        }
    }
    return j == pt_len ? str + i - j : NULL;
}
int main(int argc, char* argv[])
{
    char str1[LEN];
    char str2[LEN];

    printf("Please enter the first string (EOF to quit):\n");
    while (s_gets(str1, LEN) != NULL)
    {
        printf("Please enter the second string:\n");
        if (s_gets(str2, LEN) != NULL)
        {
            const char* temp = string_in(str1, str2);
            if (temp != NULL)
            {
                printf("String %s exists in string %s\n", str2, temp);
            }
            else
            {
                printf("String %s doesn't exist in string %s\n", str2, str1);
            }
        }
        printf("You can enter again (EOF to quit):\n");
    }
    printf("Done.\n");

    return 0;
}

9.编写一个函数,把字符串中的内容用其反序字符串代替。在一个完整 的程序中测试该函数,使用一个循环给函数提供输入值。

#include <stdio.h>
#include <string.h>
#define LEN 11
char* s_gets(char* st, int n)
{
    char* ret_val;
    char* find;

    ret_val = fgets(st, n, stdin);
    if (ret_val)
    {
        find = strchr(st, '\n');
        if (find)
        {
            *find = '\0';
        }
        else
        {
            while (getchar() != '\n')
                continue;
        }
    }
    return ret_val;
}
void reverse(char* str)
{
    int len = strlen(str);

    for (int i = 0; i < len / 2; i++)
    {
        char temp = str[i];
        str[i] = str[len - 1 - i];
        str[len - 1 - i] = temp;
    }
}
int main(int argc, char* argv[])
{
    char str[LEN] = { 0 };

    printf("Please enter a string (EOF to quit):\n");
    while (s_gets(str, LEN) != NULL)
    {
        printf("String:\n");
        puts(str);
        reverse(str);
        printf("After reversing:\n");
        puts(str);
        printf("You can enter a string again (EOF to quit):\n");
    }
    printf("Done.\n");

    return 0;
}

10.编写一个函数接受一个字符串作为参数,并删除字符串中的空格。 在一个程序中测试该函数,使用循环读取输入行,直到用户输入一行空行。 该程序应该应用该函数只每个输入的字符串,并显示处理后的字符串。

#include <stdio.h>
#include <string.h>
#define LEN 11
char* s_gets(char* st, int n)
{
    char* ret_val;
    char* find;

    ret_val = fgets(st, n, stdin);
    if (ret_val)
    {
        find = strchr(st, '\n');
        if (find)
        {
            *find = '\0';
        }
        else
        {
            while (getchar() != '\n')
                continue;
        }
    }
    return ret_val;
}

void cancel(char* str)
{
    int j = 0, len = strlen(str);

    for (int i = 0; i < len; ++i)
    {
        if (str[i] != ' ')
        {
            str[j++] = str[i];
        }
    }
    str[j] = '\0';
}
int main(int argc, char* argv[])
{
    char str[LEN];

    printf("Please enter a string (EOF or enter to quit):\n");
    while (s_gets(str, LEN) != NULL && str[0] != '\0')
    {
        printf("Source string: %s\n", str);
        cancel(str);
        printf("Delete space: %s\n", str);
        printf("You can enter a string again (EOF or enter to quit):\n");
    }
    printf("Done.\n");

    return 0;
}

11.编写一个函数,读入10个字符串或者读到EOF时停止。该程序为用 户提供一个有5个选项的菜单:打印源字符串列表、以ASCII中的顺序打印字 符串、按长度递增顺序打印字符串、按字符串中第1个单词的长度打印字符 串、退出。菜单可以循环显示,除非用户选择退出选项。当然,该程序要能 真正完成菜单中各选项的功能。

#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdbool.h>
#define ROWS 11
#define COLUMNS 11
char* s_gets(char* st, int n)
{
    char* ret_val;
    char* find;

    ret_val = fgets(st, n, stdin);
    if (ret_val)
    {
        find = strchr(st, '\n');
        if (find)
        {
            *find = '\0';
        }
        else
        {
            while (getchar() != '\n')
                continue;
        }
    }
    return ret_val;
}
int get_strings(char(*string)[COLUMNS], char** str, int n)
{
    int i;

    for (i = 0; i < n; i++)
    {
        if (s_gets(string[i], COLUMNS) != NULL)
        {
            str[i] = string[i];
        }
        else
        {
            break;
        }
    }
    return i;
}
int get_first(void)
{
    int ch;

    do
    {
        ch = tolower(getchar());
    } while (isspace(ch));
    while (getchar() != '\n')
        continue;

    return ch;
}
int show_menu(void)
{
    int ch;

    printf("+-------------------------------------------------------+\n");
    printf("|a) print for the origin          b) print for the ASCII|\n");
    printf("|c) print for the length          d) print for the words|\n");
    printf("|q) quit                                                |\n");
    printf("+-------------------------------------------------------+\n");
    printf("Please you choose: ");

    ch = get_first();
    while (ch < 'a' || ch > 'd' && ch != 'q')
    {
        printf("Please enter a, b, c, d or q: ");
        ch = get_first();
    }
    return ch;
}
int word(char* str)
{
    int length = 0;
    bool inword = false;

    while (*str)
    {
        if (!isspace(*str) && !inword)
        {
            inword = true;
            length++;
        }
        else if (!isspace(*str) && inword)
        {
            length++;
        }
        else if (isspace(*str) && inword)
        {
            break;
        }
        str++;
    }
    return length;
}
void origin_output(char(*str)[COLUMNS], int n)
{
    printf("Source strings:\n");
    for (int i = 0; i < n; i++)
    {
        puts(str[i]);
    }
    putchar('\n');
}
void ascll_output(char** str, int n)
{
    for (int i = 0; i < n - 1; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            if (strcmp(str[i], str[j]) > 0)
            {
                char* temp = str[i];
                str[i] = str[j];
                str[j] = temp;
            }
        }
    }
    printf("Print source strings for ASCII:\n");
    for (int i = 0; i < n; i++)
    {
        puts(str[i]);
    }
    putchar('\n');
}
void length_up_output(char** str, int n)
{
    for (int i = 0; i < n - 1; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            if (strlen(str[i]) > strlen(str[j]))
            {
                char* temp = str[i];
                str[i] = str[j];
                str[j] = temp;
            }
        }
    }
    printf("Print source strings for length:\n");
    for (int i = 0; i < n; i++)
    {
        puts(str[i]);
    }
    putchar('\n');
}
void first_word_output(char** str, int n)
{
    for (int i = 0; i < n - 1; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            if (word(str[i]) > word(str[j]))
            {
                char* temp = str[i];
                str[i] = str[j];
                str[j] = temp;
            }
        }
    }
    printf("Print source strings for the first word:\n");
    for (int i = 0; i < n; i++)
    {
        puts(str[i]);
    }
    putchar('\n');
}
int main(void)
{
    int n, choice;
    char* str[ROWS];
    char strings[ROWS][COLUMNS];

    printf("Please enter %d strings (EOF to quit):\n", ROWS);
    if ((n = get_strings(strings, str, ROWS)) != 0)
    {
        while ((choice = show_menu()) != 'q')
        {
            switch (choice)
            {
            case 'a':
            {
                origin_output(strings, n);
                break;
            }
            case 'b':
            {
                ascll_output(str, n);
                break;
            }
            case 'c':
            {
                length_up_output(str, n);
                break;
            }
            case 'd':
            {
                first_word_output(str, n);
                break;
            }
            }
        }
    }
    printf("Done.\n");

    return 0;
}

12.编写一个程序,读取输入,直至读到 EOF,报告读入的单词数、大 写字母数、小写字母数、标点符号数和数字字符数。使用ctype.h头文件中的 函数。

#include <stdio.h>
#include <ctype.h>
#include <stdbool.h>
int main(int argc, char* argv[])
{
    int ch, lower, upper, digit;
    int punct, words;
    lower = upper = digit = 0;
    punct = words = 0;
    bool inword = false;

    printf("Please enter some characters (EOF to quit):\n");
    while ((ch = getchar()) != EOF)
    {
        if (islower(ch))
        {
            lower++;
        }
        else if (isupper(ch))
        {
            upper++;
        }
        else if (isdigit(ch))
        {
            digit++;
        }
        else if (ispunct(ch))
        {
            punct++;
        }
        if (!isspace(ch) && !inword)
        {
            inword = true;
            words++;
        }
        if (isspace(ch) && inword)
        {
            inword = false;
        }
    }
    printf("Words: %d\n", words);
    printf("Lower: %d\n", lower);
    printf("Upper: %d\n", upper);
    printf("Digit: %d\n", digit);
    printf("Punct: %d\n", punct);

    return 0;
}

13.编写一个程序,反序显示命令行参数的单词。例如,命令行参数是 see you later,该程序应打印later you see。

#include <stdio.h>
int main(int argc, char* argv[])
{
    if (argc < 2)
    {
        printf("Usage: %s words\n", argv[0]);
    }
    else
    {
        printf("Words:\n");
        for (int i = 1; i < argc; i++)
        {
            printf("%s ", argv[i]);
        }
        printf("\nReversing printing is:\n");
        for (int i = argc - 1; i > 0; i--)
        {
            printf("%s ", argv[i]);
        }
        putchar('\n');
    }

    return 0;
}

14.编写一个通过命令行运行的程序计算幂。第1个命令行参数是double 类型的数,作为幂的底数,第2个参数是整数,作为幂的指数。

#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[])
{
    int exp;
    double num, sum = 1.0;

    if (argc != 3)
    {
        printf("Usage: %s floating-point exp\n", argv[0]);
    }
    else
    {
        num = atof(argv[1]), exp = atoi(argv[2]);
        for (int i = 1; i <= exp; i++)
        {
            sum *= num;
        }
        printf("%g ^ %d is %g.\n", num, exp, sum);
    }

    return 0;
}

15.使用字符分类函数实现atoi()函数。如果输入的字符串不是纯数字, 该函数返回0。

#include <string.h>
#include <ctype.h>
#define LEN 11
int myatoi(char* str)
{
    int n = 0, len = strlen(str);

    for (int i = 0; i < len; i++)
    {
        if (!isdigit(str[i]))
        {
            return 0;
        }
        n = n * 10 + (str[i] - '0');
    }
    return n;
}
int main(int argc, char* argv[])
{
    char str[LEN];

    printf("Please enter a string (EOF to quit):\n");
    while (scanf("%s",str) != 0)
    {
        printf("String %s convert number %d\n", str, myatoi(str));
        printf("You can enter a string again (EOF to quit):\n");
    }
    printf("Done.\n");

    return 0;
}

16.编写一个程序读取输入,直至读到文件结尾,然后把字符串打印出 来。该程序识别和实现下面的命令行参数:

-p 按原样打印

-u 把输入全部转换成大写

-l 把输入全部转换成小写

如果没有命令行参数,则让程序像是使用了-p参数那样运行。

#include <stdio.h>
#include <ctype.h>
void print_upper(char* str)
{
    printf("转换小写字母后的字符串为:");
    while (*str != '\0')
    {
        putchar(toupper(*str++));
    }
    printf("\n");
}
void print_lower(char* str)
{
    printf("转换大写字母后的字符串为:");
    while (*str != '\0')
    {
        putchar(tolower(*str++));
    }
    printf("\n");
}
int main(int argc, char* argv[])
{
    char str[1024] = { 0 };
    char c = '0';

    printf("请输入字符串和参数(p,u,l):");
    while (scanf("%s %c", str, &c) != EOF)
    {
        switch (c)
        {
            case 'p':
                printf("原来的字符串为:%s\n", str);
                printf("请输入字符串和参数(p,u,l):");
                break;
            case 'u':
                print_upper(str);
                printf("请输入字符串和参数(p,u,l):");
                break;
            case 'l':
                print_lower(str);
                printf("请输入字符串和参数(p,u,l):");
                break;
        }
    }
    return 0;
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/584628.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

《Opencv3编程入门》学习笔记—第二章

《Opencv3编程入门》学习笔记 记录一下在学习《Opencv3编程入门》这本书时遇到的问题或重要的知识点。 第二章 OpenCV 官方例程引导与赏析 openv官方提供的示例程序&#xff1a;具体位于..\opencv\sources\samples\cpp ..\opencv\sources\samples\cpp\tutorial_code路径下存…

sql优化常用的方法

文章目录 1、explain 输出执行计划2、in 和 not in 要慎用3、少用select *4、善用limit 15、 order by字段建索引6、count(*)推荐使用7、where 子句中避免is null /is not null8、应尽量避免在 where!或<>9、应尽量避免在 where 子句中使用 or10、尽量用union all代替uni…

了不起的互联网老男孩,在创业路上不掉队

“青春如同奔流的江河&#xff0c;一去不回来不及道别”&#xff0c;老男孩这首歌戳中了太多职场中年男人的心酸苦楚&#xff0c;面对经济下行压力、互联网行业变革以及中年职场危机&#xff0c;互联网人应该如何应对&#xff1f;如何建立和现实叫板的能力&#xff1f; 有2位在…

shiro入门实战

​​​​​​​Apache Shiro | Simple. Java. Security. java语言编写 架构 shiro认证流程 使用 添加shiro依赖 <dependency><groupId>org.apache.shiro</groupId><artifactId>shiro-core</artifactId><version>1.4.0</version>&l…

V2.0-在记事本功能上添加fork和wait

第一篇只是简单使用了open&#xff0c;read,write,lseek实现了基本的记事本功能&#xff1b; 但是当前的系统是linux&#xff0c;应该发挥他的多进程&#xff0c;多线程的作用&#xff1b; 所以&#xff0c;本篇添加创建子进程和父进程等待子进程退出的功能。 有几个注意点&a…

如何创建新一代Web3企业

日前&#xff0c;我们对话了Sui基金会的增长负责人Koh Kim&#xff0c;对如何成功构建持续发展的企业等话题展开讨论。 您在Sui基金会的工作重点帮助开发者&#xff0c;让他们从产品开发的早期阶段成长为强大且具有潜力的企业领导者。可以简单分享一下您为此目标创建的计划吗&…

Linux进程地址空间——下篇

目录 一.深入了解进程地址空间&#xff1a; 单个进程与进程地址空间与物理内存之间的联系图&#xff1a; 多个进程与进程地址空间与物理内存之间的联系图&#xff1a; 二.为什么会存在进程地址空间呢&#xff1f; 作用1&#xff1a;进程地址空间的存在&#xff0c;保证了其他…

Flutter 笔记 | Flutter 文件IO、网络请求、JSON、日期与国际化

文件IO操作 Dart的 IO 库包含了文件读写的相关类&#xff0c;它属于 Dart 语法标准的一部分&#xff0c;所以通过 Dart IO 库&#xff0c;无论是 Dart VM 下的脚本还是 Flutter&#xff0c;都是通过 Dart IO 库来操作文件的&#xff0c;不过和 Dart VM 相比&#xff0c;Flutte…

6.1 进程的创建和回收

目录 进程概念 程序 进程 进程内容 进程控制块 进程类型 进程状态 常用命令 查看进程信息 进程相关命令 进程的创建和结束 子进程概念 子进程创建-fork 父子进程 进程结束-exit/_exit 进程结束-exit-示例1 进程结束-exit-示例2 进程回收 进程回收-wait 进程回…

企业数字化转型,为什么会加快商业智能BI的发展

对于企业数字化转型来说&#xff0c;数据是其中提到最多的词汇。当今世界&#xff0c;随着人们认识到数据的重要性&#xff0c;明白了数据发挥价值的方式及其意义&#xff0c;数据资产就成为数字化转型企业需要掌握利用的关键。 数据可视化 - 派可数据商业智能BI可视化分析平台…

服务windows服务+辅助角色服务

1、vs2022新建一个windows服务项目 2、修改服务参数 &#xff08;1&#xff09;AutoLog: 是否将事件写入到windows的事件日志中。 &#xff08;2&#xff09;canpauseandContinue:服务是否可以暂停和继续 3、添加服务安装程序 在界面内右击鼠标 新建一个服务、新建后如下图&a…

【运维】speedtest测试

目录 docker 布署 布署云端 docker布署 云端放置于已有容器里 librespeed/speedtest: Self-hosted Speedtest for HTML5 and more. Easy setup, examples, configurable, mobile friendly. Supports PHP, Node, Multiple servers, and more (github.com) docker 布署 获取…

探讨生产环境下缓存雪崩的几种场景及解决方案

本文首发自「慕课网」&#xff08;www.imooc.com&#xff09;&#xff0c;想了解更多IT干货内容&#xff0c;程序员圈内热闻&#xff0c;欢迎关注"慕课网"或慕课网公众号&#xff01; 作者&#xff1a;大能 | 慕课网讲师 缓存我们经常使用&#xff0c;但是有时候我们…

如何撤消 Git 中最新的本地提交?

在使用Git进行版本控制时&#xff0c;有时我们可能会犯下错误或者想要撤销最新的本地提交。Git提供了一些强大的工具和命令&#xff0c;使我们能够轻松地撤消最近的提交并修复错误。 本文将详细介绍如何在Git中撤消最新的本地提交。 步骤1&#xff1a;查看提交历史 在撤消最新…

Centos7安装Java8(在线安装避坑详细安装)

开篇语&#xff1a; 喜欢在一个明媚阳光的午后 坐在那夕阳斑驳的南墙下 听着风起 闻着花香 望着远山 身边是你 如此便觉得很好 1.查看目前环境 rpm -qa|grep jdk在这里我们会发现&#xff0c;原有系统安装有jdk&#xff0c;如果对于jdk有要求&#xff0c;我们就需要重新安装jdk…

Liunx网络基础(3)传输层(TCP/UDP)可靠传输、字节流传输等

传输层协议 传输层协议解析: 负责两端之间的数据传输; TCP/ UDP 1. UDP UDP: 用户数据报协议&#xff0c;无连接&#xff0c;不可靠&#xff0c;面向数据报传输 重点: 协议格式&#xff0c;协议特性&#xff0c;特性对于编程的影响 协议格式&#xff1a; 16位源端口 & 16位…

2023-05-29 用 fltk gui库编写一个打字练习程序

用 fltk gui库编写一个打字练习程序 前言一、FLTK GUI 库二、使用步骤1.引入库2.使用代码 总结 前言 给孩子练习键盘打字, 发现终端还是欠点意思, 研究了一下gui, 最终用 fltk库弄了一个. 对于没有接触过gui的人, 发现, 编程的逻辑和终端区别很大, 很繁琐, 可能需要适应适应,…

Windows远程Centos7图形化界面

一、centos7服务器安装tigervnc 1、更新yum源 yum update 2、安装tigervnc yum -y install tigervnc* 3、启动vnc vncserver &#xff08;1&#xff09;执行命令后需要输入密码 &#xff08;2&#xff09;再次输入密码 注意&#xff1a;密码一定要记住&#xff0c;方便以…

链表反转方法汇总

反转范围之前有节点&#xff0c;prev就指向该节点&#xff0c;没有就prevnull&#xff1b; 一、头插法 class Solution {public ListNode reverseList(ListNode head) {ListNode header new ListNode(-1);ListNode cur head;while(cur ! null) {ListNode tmp cur.next;cur.…

LabVIEWCompactRIO 开发指南第六章41 同步模块

同步模块 同时运行的模块每个通道有一个ADC&#xff0c;并且采集数据时通道之间没有明显的偏差。同步模块的两个子类别&#xff0c;按需和三角积分&#xff0c;通过SPI总线传输数据&#xff0c;并受到其他SPI总线模块的所有规格和挑战的约束。 按需转换 表6.1.具有按需转换的…