2022-02-20

WARNING: This article may be obsolete
This post was published in 2022-02-20. Obviously, expired content is less useful to users if it has already pasted its expiration date.
This article is categorized as "Garbage" . It should NEVER be appeared in your search engine's results.

继续复习C语言

enum 枚举类型

🔗 [C enum(枚举) | 菜鸟教程] https://www.runoob.com/cprogramming/c-enum.html

// 程序来自https://www.runoob.com/cprogramming/c-enum.html

#include <stdio.h>

enum {
    MON = 1, TUE, WED, THU, FRI, SAT, SUN
} day;

int main() {
    for (day = MON; day <= SUN; day++) {
        printf("%d\n", day);
    }
}

结果:

1
2
3
4
5
6
7

有关enum的数值:

typedef

🔗 [C typedef | 菜鸟教程] https://www.runoob.com/cprogramming/c-typedef.html

类似return (char *)val的语法(待续)

(待续)

python3 多行输入

🔗 [python - How to get multiline input from user - Stack Overflow] https://stackoverflow.com/questions/30239092/how-to-get-multiline-input-from-user

print("Enter/Paste your content. Ctrl-D or Ctrl-Z ( windows ) to save it.")
contents = []
while True:
    try:
        line = input()
    except EOFError:
        break
    contents.append(line)
print(contents)

OCR辅助查找工具

注意:第一个枚举成员的默认值为整型的 0,后续枚举成员的值在前一个成员上加1。我们在这个实例中把第一个枚举成员的值定义为 1,第二个 就为2,以此类推。可以在定义枚举类型时改变枚举元素的值:enum season {spring, summer=3, autumn, winter};没有指定值的枚举元素,其值为前一元素加1。也就说 spring 的值为O,summer 的值为3, autumn 的值为4, winter 的值为5


 Last Modified in 2022-02-28 

Leave a Comment Anonymous comment is allowed / 允许匿名评论