搜尋此網誌

2025年7月20日星期日

Switch statements

In C++, a switch statement is used to execute one out of multiple code blocks based on the value of a variable. It’s especially handy when dealing with multiple if-else conditions that all check the same variable.

handy: easy to use or to do

The expression must evaluate to an integral or enumeration type (int, char, enum, etc.).

Each case compares the expression against a constant.

Use break to stop execution after a matching case—if omitted, execution "falls through" to the next case.

Default is optional and acts as a fallback when no case matches.

std::flush is a stream manipulator in C++ used to force the output buffer to flush immediately—meaning all characters that have been sent to the stream are written out, even if the buffer isn’t full

Microsoft Copilot

Lucky Kid

set into: to insert or embed something into a surface or object, so that it is securely held in place

back deck: an outdoor platform, usually made of wood or composite materials, that is attached to the back of a house

strew: to cover a surface with things

confiscate: to officially take something away from somebody, especially as a punishment

when you rev an engine or it revs, it runs quickly

rustle: if something dry and light rustles or you rustle it, it makes a sound like paper, leaves, etc. moving or rubbing together

thrilled: very excited and pleased

stiffness: the fact of being hard and difficult to bend or move

obsessive: thinking too much about one particular person or thing, in a way that is not reasonable or normal

contrarian: a person who opposes or rejects popular opinion, especially in financial markets

troll: to search for or try to get something

brochure: a small magazine or online document containing pictures and information about something or advertising something

The Lenni Lenape, also known as the Delaware Indians, are an Indigenous people of the Northeastern Woodlands.

indigenous: (of people and their culture) coming from a particular place and having lived there for a long time before other people came there; relating to, belonging to or developed by these people

chronology: ​the order in which a series of events happened; a list of these events in order

quaint: attractive in an unusual or old-fashioned way

fictitious: invented by somebody rather than true

granite: ​a type of hard grey stone, often used in building

muster: collect or assemble

fabricate: to make or produce goods, equipment, etc. from various different materials

jester: a man employed in the past at the court of a king or queen to entertain people by telling jokes and funny stories

tome: ​a large, heavy book, especially one dealing with a serious topic

take root: (of an idea) to become accepted widely

accrue: to increase over a period of time

empowerment: the act of giving somebody more control over their own life or the situation they are in


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

2025年7月17日星期四

If-else

The ternary conditional operator is a compact way to write conditional expressions in many programming languages. It’s called “ternary” because it takes three operands: a condition, a result if true, and a result if false.

In C++, the return statement is used to exit a function and optionally send a value back to the caller. It’s a key part of how functions communicate results.

++x Increment first, then use the value

x++ Use the value first, then increment

parentheses: DJ[pəˋrenθisi:z]

versatile: DJ[ˋvə:sətail] able to do many different things

Microsoft Copilot

2025年7月15日星期二

If statements in C++

No "then" keyword

In C++, the percent symbol % is used as the modulus operator. It calculates the remainder after dividing one integer by another.

In C++, == is the equality operator. It checks whether two values are equal and returns true if they are, and false otherwise.

In C++, bool is a built-in type used to represent Boolean values—essentially, values that are either true or false.

1: true

0: false

In C++, != is the inequality operator. It checks whether two values are not equal. If they are different, it returns true; if they’re the same, it returns false.

In C++, && is the logical AND operator, used to combine two Boolean expressions. It returns true only if both expressions are true—otherwise, it returns false.

affirmative: (also positive) (of a statement) expressing something that is true, did happen, etc.; not containing words such as ‘no’, ‘not’, ‘never’, etc.

subtle: not very obvious or easy to notice

Microsoft Copilot

Retarded?!

    If these supposed experts do not know what to do with me, why should I care about their opinions?

crackle: to make short sharp sounds like something that is burning in a fire

intercom: a system of communication by phone or radio inside an office, plane, etc.; the device you press or switch on to start using this system

roust: to drive (as from bed) roughly or unceremoniously

unceremoniously: in a rough or rude way, without caring about a person’s feelings

blast out:  to make a loud unpleasant noise, especially music

impeccably: in a way that has no mistakes or faults

iron out: to get rid of any problems or difficulties that are affecting something

feminist: ​DJ[ˋfeminist] having or based on the belief that women should have the same rights and opportunities as men

pantsuit: ​a woman’s suit of jacket and pants

assert something to: make other people recognize your right or authority to do something, by behaving in a determined and confident way

mystique: the quality of being mysterious or secret that makes somebody/something seem interesting or attractive

rung: ​one of the bars that forms a step in a ladder

frenetic: ​involving a lot of energy and activity in a way that is not organized

soccer: DJ[ˋsɔkə]

memorabilia: things that people collect because they once belonged to a famous person, or because they are connected with a particular interesting place, event or activity

maxim: a well-known phrase that expresses something that is usually true or that people think is a rule for sensible behavior

endeavor: an attempt to do something, especially something new or difficult

reveille: a tune that is played to wake soldiers in the morning; the time when it is played

makeshift: used temporarily for a particular purpose because the real thing is not available

overpass: ​a bridge that carries one road over another one

tiff: a slight argument between close friends or two people who love each other

aggression: a violent attack or threats by one person against another person or by one country against another country

scrawny: ​(of people or animals) very thin in a way that is not attractive

squeaky: making a short, high sound

brawler: ​a person who takes part in a noisy and violent fight, usually in a public place

​engender something: to make a feeling or situation exist

nerd: a person who is boring, stupid and not fashionable

jock: a man or boy who plays or enjoys sport a lot, especially one who does not have many other interests

studious: spending a lot of time studying or reading

diligent: ​showing care and effort in your work or duties

tease about: to laugh at somebody and make jokes about them, either in a friendly way or in order to annoy them or make them embarrassed

differentiator: one that differentiates

niche: a comfortable or suitable role, job, way of life, etc.

wallow (in something) (of large animals or people): to lie and roll about in water or mud, to keep cool or for pleasure

when people ham it up, they deliberately exaggerate their emotions or movements

exaggerate: to make something seem larger, better, worse or more important than it really is

gloat: to show that you are happy about your own success or somebody else’s failure, in an unpleasant way

feat: ​an action or a piece of work that needs skill, strength or courage

punctuation: the marks used in writing that divide sentences and phrases; the system of using these marks

verdict: a decision that you make or an opinion that you give about something, after you have tested it or considered it carefully

kindred: very similar; related

foghorn: a device that makes a loud noise to warn ships of danger in fog

contrarian: a person who opposes or rejects popular opinion, especially in financial markets

streak: a part of a person’s character, especially an unpleasant part

meld: to combine with something else; to make something combine with something else

jokester: joker

persona: the aspects of a person’s character that they show to other people, especially when their real character is different

outwardly: on the surface; in appearance

clash over: an argument between two people or groups of people who have different beliefs and ideas

epic: taking place over a long period of time and involving a lot of difficulties

physicality: the quality of being physical rather than emotional or spiritual

tow-headed: having very light blonde or untidy hair

linebacker: (in American football) a defensive player who tries to tackle members of the other team

touchdown: (in American football) an act of scoring points by crossing the other team’s goal line while carrying the ball, or receiving the ball when you are over the other team’s goal line

complimentary: expressing approval, praise, etc.

thrilled: DJ[θrild] very excited and pleased

domino theory: a theory that if one nation becomes Communist-controlled the neighboring nations will also become Communist-controlled

hands down: (informal) easily and without any doubt


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

www.merriam-webster.com

2025年7月13日星期日

Registered Nurse

    目標實現了,便是光榮;目標實現不了,人生也會因這一路風雨跋涉變得豐富而充實;在我看來,這就是不虛此生。

節錄自汪國真《我喜歡出發》

Auto Focus

AF-S (AF single, sometimes called single area AF) mode, is good for photographing subjects that do not move, such as flowers or portraits etc.

www.slrphotographyguide.com

Baby

hangman: a game in which one player chooses a word and the other players try to guess it, letter by letter. Each time they guess wrongly, the first person draws one part of a person being hanged. The other players have to guess the word before the drawing is complete

gallows: a structure on which people, for example criminals, are killed by hanging

mitigate something: to make something less harmful, serious, etc.

rambunctious: full of energy in a cheerful and noisy way

floor somebody: to surprise or confuse somebody so that they are not sure what to say or do

disruptive: causing problems, noise, etc. so that something cannot continue normally


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

2025年7月11日星期五

On the Stage by Yoasobi

So, I'm standing on the top of the stage of my dreams

And now the signal echoes loud in my ears

Time after time, been imagining this moment

Outdoing all versions of me, I'll prevail

Taking a deep breath, inhale and exhale

And in silence I raise my gaze, it unveils

Everything I've done up to this point of time

I realize wasn't in vain, but led to now

No doubt, the future that I have seen in my dreams

Has started now, unfolding where I stand

outdo somebody/something: to do more or better than somebody else

prevail: [intransitive] to exist or be very common at a particular time or in a particular place

unveil something: to remove a cover or curtain from a painting, statue, etc. so that it can be seen in public for the first time

in vain: without success

Online Dictionary Used: www.oxfordlearnersdictionaries.com

2025年7月10日星期四

Tutankhamun

故宮館十一月古埃及展 圖坦卡門巨像助陣

    【明報專訊】香港故宮文化博物館十一月二十日推出逾九個半月的特別展覽「古埃及文明大展︰埃及博物館珍藏」,將展示二百五十件埃及文物,包括法老與諸神雕像、大型成套木乃伊棺、動物木乃伊等,皆首次在港亮相,當中不少亦是首次在埃及境外巡展。故宮館長吳志華昨表示,門票銷售安排八月公布,將是「所有人皆負擔得起」的票價,盼吸引六十萬至七十萬入場人次。

共七間博物館二百五十件藏品 遠溯七千三百年

    香港故宮館與埃及最高文物委員會昨簽訂合作協議,在港合辦「古埃及文明大展︰埃及博物館珍藏」。特別展覽分成「法老的國度」、「圖坦卡門的傳奇」、「薩卡拉的秘密」及「古埃及與世界」共四個單元,囊括埃及七間重要博物館共二百五十件藏品,最久遠可追溯至七千三百年前,最年輕的距今亦已二千年。

    「圖坦卡門的傳奇」將介紹少年法老圖坦卡門的一生及其陵墓的考古發現,展出包括高逾二點八米的巨型石雕「圖坦卡門巨像」。圖坦卡門繼位時僅九歲,任內推翻「一神教」宗教改革,帶領埃及回歸傳統多神信仰,惟十八歲就逝世,其官方紀錄亦遭後繼者赫倫布抹去,至一九二二年始由考古學家挖掘出圖坦卡門的陵墓。

    另一單元「薩卡拉的秘密」則聚焦薩卡拉遺址的考古成果,展出彩繪人形棺、動物木乃伊及神像等,重點展品包括「芭絲特持叉鈴像」及「貓木乃伊」。芭絲特女神常以貓頭人身或直接以貓的形象示人,原為戰爭女神,後期與母性、家庭與保護有更大聯繫,兼具音樂、舞蹈和美等職能。古埃及人會大量飼養貓並製作木乃伊獻予芭絲特女神祈求保佑。

    其餘兩個單元為「法老的國度」及「古埃及與世界」。前者會聚焦法老時代的古埃及文明發展,後者則會探討古埃及和世界其他文明的交流與對話。

港最大埃及展 盼九個月吸七十萬人

    特別展覽展期至明年八月底結束。港故宮表示,今次展覽乃本港史上規模最大且展期最長的古埃及文物展,亦是埃及最高文物委員會第二次與亞洲博物館合辦展覽,盼紀念中國與埃及兩大文明古國建交七十周年。吳志華相信今次展覽非常受歡迎,目標吸引六十萬至七十萬人次。

二零二五年六月二十七日

2025年7月8日星期二

Arrays, Pointers and Strings

*distances.begin()

Adding the asterisk * dereferences that iterator, giving you access to the actual value stored at that position.

When you declare something as public in a class, it means it’s accessible from outside the class.

class MyClass {
public:
    void sayHello() {
        std::cout << "Hello from public method!" << std::endl;
    }
};

int main() {
    MyClass obj;
    obj.sayHello();  // Totally fine—sayHello is public
    return 0;
}

The arrow operator (->) in C++ is used to access members (variables or functions) of an object through a pointer. It’s essentially shorthand for dereferencing a pointer and then accessing a member.

In C++, a C string (also called a C-style string) is a sequence of characters stored in a character array and terminated by a null character ('\0'). 

In C++, arrays and pointers are closely related --- but not identical. Their relationship is one of the most fundamental (and sometimes confusing) aspects of the language.

Array name as a pointer: In most contexts, the name of an array decays into a pointer to its first element.

int arr[5] = {10, 20, 30, 40, 50};
int* ptr = arr;  // Equivalent to: int* ptr = &arr[0];

Microsoft Copilot

School Life

ironclad: so strong that it cannot be challenged or changed

undermine: to make something, especially somebody’s confidence or authority, gradually weaker or less effective

arbitrary: DJ[ˋɑ:bi͵trəri] not seeming to be based on a reason, system or plan and sometimes seeming unfair

bear the brunt of something: to receive the main force of something unpleasant

recalcitrance: the fact of being unwilling to obey rules or follow instructions; the fact of being difficult to control

stalemate: a disagreement or a situation in a competition in which neither side is able to win or make any progress

transgression: an act that goes beyond the limits of what is morally or legally acceptable

snide: ​criticizing somebody/something in an unkind and indirect way

muster: to find as much support, courage, etc. as you can

bratty: (of a person, especially a child) badly behaved

wiseass: smart aleck

smart aleck: an obnoxiously conceited and self-assertive person with pretensions to smartness or cleverness

obnoxiously: in an extremely unpleasant way, especially in a way that offends people

conceited: being too proud of yourself and what you do

self-assertive: very confident and not afraid to express your opinions

pretension: ​the act of trying to appear more important, intelligent, etc. than you are in order to impress other people

pull back: to move back from a place

tamp: tamp something (down) to press something down hard, especially into a closed space

deliberate: done on purpose rather than by accident

notion: an idea, a belief or an understanding of something

jibe: to say something that is intended to make somebody look silly or feel embarrassed

The Wind in the Willows: novel by Kenneth Grahame

roam: (of the eyes or hands) to move slowly over every part of somebody/something

caveman: a person who lived in a cave thousands of years ago

dictate: to control or influence how something happens

husbandry: farming, especially when done carefully and well

sleuthing: the act of investigating a crime or mysterious event


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

www.merriam-webster.com

2025年7月6日星期日

The string class

The object-oriented approach (often shortened to OOP) is a way of designing and writing software by organizing code around objects rather than just functions and logic. It’s one of the most popular programming paradigms and is used in many modern languages like Java, Python, C++, and C#.

In C++: <string>
This header provides the std::string class, a more powerful and safer alternative to C-style strings.
It supports:
- Dynamic memory management
- Operator overloading (e.g., +, ==)

Dynamic memory management is the process of allocating and freeing memory at runtime, rather than at compile time. It’s essential when you don’t know in advance how much memory your program will need --- like when handling user input, working with large datasets, or building flexible data structures like linked lists or trees.

In C++, strncpy() is a legacy function inherited from the C standard library, defined in the <cstring> header. It’s used to copy a fixed number of characters from one C-style string to another. While it works in C++, it's generally recommended to use std::string for safer and more expressive string handling.

In C++, strncat() is a legacy function from the C standard library used to append a limited number of characters from one C-style string to another. It’s declared in the <cstring> header and works directly with character arrays.

semantics: the study of the meanings of words and phrases

concatenation: a series of things or events that are linked together

exhaustive: including everything possible; very careful or complete

Microsoft Copilot
www.oxfordlearnersdictionaries.com

2025年7月3日星期四

His teacher

"Fall of a year" refers to the season of autumn, especially in North America.

qualm: a feeling of doubt or worry about whether what you are doing is right

unbeknownst: without the person mentioned knowing

penmanship: ​the art of writing by hand; skill in doing this

cursive: ​(of handwriting) with the letters joined together

showboating: behavior that is intended to show people how clever, skillful, etc. you are

flute: a musical instrument of the woodwind group, like a thin pipe in shape. The player holds it to the side of his or her face and blows across a hole at one end.

memento: a thing that you keep or give to somebody to remind you or them of a person or place

slaughterhouse: a building where animals are killed for food

seep: (especially of liquids) to flow slowly and in small quantities through something or into something

unveil: to remove a cover or curtain from a painting, statue, etc. so that it can be seen in public for the first time

awe: feelings of respect and slight fear; feelings of being very impressed by something/somebody

appalled: feeling or showing horror at something unpleasant or wrong

crackle: to make short sharp sounds like something that is burning in a fire

scribble: to write something quickly and carelessly, especially because you do not have much time


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

2025年7月2日星期三

Tile

encaustic: a paint made from pigment mixed with melted beeswax and resin and after application fixed by heat

Stoke-on-Trent: city in England

www.merriam-webster.com/dictionary

2025年7月1日星期二

C strings

consecutive: following one after another in a continuous series

The null character --- written as '\0' in C and C++ --- is a special character used to mark the end of a string in many programming languages, especially those influenced by C.

<cstring> Header in C++

This is part of the C++ Standard Library, inherited from C’s <string.h>. It provides functions for manipulating C-style strings (null-terminated character arrays).

The String class is a fundamental part of many programming languages, used to represent and manipulate sequences of characters.

std::string greeting = "Hello";
greeting += " World";
std::cout << greeting;  // Output: Hello World

size_t is a special unsigned integer type used in C and C++ to represent the size of objects in memory or array indices.

An unsigned integer is a whole number data type that can only represent non-negative values—that is, zero and positive numbers.

A character array is a data structure used to store a sequence of characters --- essentially, it's how many programming languages represent strings under the hood.

ASCII stands for American Standard Code for Information Interchange. It’s a character encoding standard that assigns numeric values to letters, digits, punctuation marks, and control characters so computers can store and exchange text reliably.

In C++, strncpy() is a function from the C standard library (inherited via <cstring>) used to copy a fixed number of characters from one C-style string to another. It's a bit of a double-edged sword --- powerful but easy to misuse if you're not careful.

The sizeof operator in C and C++ is used to determine the size, in bytes, of a data type or object at compile time.

strncpy(name, src, sizeof(name) - 1);
name[5] = '\0';  // Manually null-terminate

Here, the -1 is used because:
You reserve the last slot for the null terminator.
You copy at most n - 1 characters to avoid overflow.
Then manually add '\0' at the end.

concatenate: to link together in a series or chain

The strcat() function in C is used to concatenate two C-style strings—that is, it appends one string to the end of another.

The strncat() function in C is used to safely concatenate a limited number of characters from one C-style string to another.

In C++, strlen() is a function from the C standard library (accessible via <cstring>) that returns the length of a null-terminated C-style string, excluding the null character '\0'.

Microsoft Copilot
www.oxfordlearnersdictionaries.com
www.merriam-webster.com

Top seller

dog-eared: (of a book) used so much that the corners of many of the pages are turned down

distillation: (formal) the process or result of getting the essential meaning, ideas or information from something

advancement: progress in a job, social class, etc.

boot camp: a training camp for new members of the armed forces, where they have to work hard

filbert: a type of hazel tree that produces oval nuts

pecan: the nut of the American pecan tree with a smooth pink-brown shell

daunting: making somebody feel nervous and less confident about doing something; likely to make somebody feel this way

tally: a record of the number or amount of something, especially one that you can keep adding to

parameter: ​something that decides or limits the way in which something can be done

pistol: a small gun that you can hold and fire with one hand

If you say that a person, a team, an organization, etc. has bragging rights, you mean that they have achieved a good result or are better or more successful than their competitors or opponents at that time.

steep: sudden and very big

pitch: to set something at a particular level

hash mark: service stripe

service stripe: a stripe worn on an enlisted person's left sleeve to indicate three years of service in the army or four years in the navy

perennial: ​continuing for a very long time; happening again and again


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

www.merriam-webster.com