搜尋此網誌

2025年9月9日星期二

Returning values from a function

Returning values from a function in C++ is a fundamental concept that allows a function to send data back to the part of the program that called it.

Here’s a simple function that returns an int:

int add(int a, int b) {

    return a + b;  // returns the sum of a and b

}


int main() {

    int result = add(5, 3);

    cout << "Result: " << result << endl;  // Output: 8

}


int add(int a, int b) → declares a function that returns an int.

return a + b; → sends the result back to the caller.


Microsoft Copilot

vector and range-based for loop

A vector in C++ is a dynamic array provided by the Standard Template Library (STL). Unlike regular arrays, vectors can resize automatically when elements are added or removed, making them incredibly flexible and widely used.

#include <iostream>

#include <vector>

using namespace std;


int main() {

    vector<int> numbers;           // Declare an empty vector of ints

    numbers.push_back(10);         // Add elements

    numbers.push_back(20);

    numbers.push_back(30);


    cout << "Size: " << numbers.size() << endl;  // Output: 3


    // Access elements

    cout << "First element: " << numbers[0] << endl;  // Output: 10


    // Update element

    numbers[1] = 25;


    // Traverse using range-based for loop

    for (int num : numbers) {

        cout << num << " ";

    }

    return 0;

}


numbers is a vector<int> — a dynamic array of integers.

for (int num : numbers) means:

👉 “For each element in the numbers vector, assign its value to num, and then execute the loop body.”

Inside the loop:

cout << num << " "; prints the current number followed by a space


Microsoft Copilot

A typical example of function overloading

#include <iostream>

using namespace std;


// Overloaded print function for int

void print(int i) {

    cout << "Printing int: " << i << endl;

}


// Overloaded print function for double

void print(double d) {

    cout << "Printing double: " << d << endl;

}


// Overloaded print function for string

void print(const string& s) {

    cout << "Printing string: " << s << endl;

}


int main() {

    print(42);           // Calls print(int)

    print(3.14);         // Calls print(double)

    print("Hello C++");  // Calls print(string)

    return 0;

}


Microsoft Copilot

求學時期的 Bill Gates

In my emerging worldwide, the logic and rational thinking demanded by mathematics were skills that could be used to master any subject. There was a hierarchy of intelligence: however good you were at mathematics, that's how good you could be at other subjects --- biology, chemistry, history, even languages.

在他嶄新的世界觀中,數學所要求的邏輯與理性思維是一種技能,可以用來掌握任何學科。智慧存在一個等級體系:你的數學有多好,你在其他學科——生物、化學、歷史,甚至語言——就能有多出色。

Hood Canal is a natural fjord, not a canal, that sits between the Puget Sound and Olympic Mountains in Mason County, Washington.

fjord: a long narrow area of sea between high cliffs

lug: to carry or drag something heavy with a lot of effort

lodge: a small house in the country where people stay when they want to take part in some types of outdoor sport

leap: to jump high or a long way

distinctly: in a way that shows a quality that is easy to recognize

also-ran: a person who is not successful, especially in a competition or an election

camaraderie: a feeling of friendship and trust among people who work or spend a lot of time together

cheerio: goodbye

dub: to give somebody/something a particular name, often in a humorous or critical way

spearhead: a person or group that begins an activity or leads an attack against somebody/something

relish: to get great pleasure from something; to want very much to do or have something

infallible: that never fails; always doing what it is supposed to do

elicit: to get information or a reaction from somebody, often with difficulty

chuckle: an act of laughing quietly

gall: rude behavior showing a lack of respect that is surprising because the person behaving badly is not embarrassed

gratuitously: DJ[græˋtju:itəsli] ​without any good reason or purpose, in a way that may have harmful effects

betray: to hurt somebody who trusts you, especially by lying to or about them or telling their secrets to other people

auditorium: DJ[͵ɔ:diˋtɔ:riəm] the part of a theatre, concert hall, etc. in which the audience sits

mediocre: DJ[ˋmi:diəukə] not very good; of only average standard

exempt:  if somebody/something is exempt from something, they are not affected by it, do not have to do it, pay it, etc.

slumped: sitting with your body leaning forward, for example because you are asleep or unconscious

feed your ego: engage in actions or receive experiences, such as praise, success, or validation, that make you feel important, better about yourself, and boost your self-esteem.

weirdo: DJ[ˋwiədəu] a person who looks strange and/or behaves in a strange way

up-and-coming: likely to be successful and popular in the future

outscore: to score more points than

"To be borne out" means to be confirmed, substantiated, or proven true by evidence or facts.


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

www.merriam-webster.com

Some explanations are provided by Google AI Overview.

Translated with the help of Microsoft Copilot and edited.

2025年9月4日星期四

Default arguments

When defining a function, default arguments must be specified from right to left.

// ✅ Valid

void greet(string name, string greeting = "Hello");


// ❌ Invalid

void greet(string name = "User", string greeting);

If you try to set a default for a parameter on the left while leaving one on the right without a default, the compiler (or interpreter) won’t know how to match arguments during a function call. It creates ambiguity.


Correct example

#include <iostream>

using namespace std;


// Default argument is on the right

void greet(string name, string greeting = "Hello") {

    cout << greeting << ", " << name << "!" << endl;

}


int main() {

    greet("Alice");              // Uses default greeting: "Hello"

    greet("Bob", "Good morning"); // Uses custom greeting

    return 0;

}


Incorrect example

#include <iostream>

using namespace std;


// ❌ Invalid: default argument on the left

// This will cause a compilation error

void greet(string name = "User", string greeting);


int main() {

    greet("Alice", "Hi");

    return 0;

}

The compiler doesn’t know how to interpret greet("Alice")—is "Alice" the name or the greeting?


Function Declaration

  • What it is: A promise to the compiler that a function exists.
  • Purpose: Tells the compiler the function’s name, return type, and parameters—so it can be called before it’s defined.
  • No implementation: It doesn’t contain the actual code.
int add(int a, int b);  // Declaration only

Function Definition
  • What it is: The actual implementation of the function.
  • Purpose: Contains the code that runs when the function is called.
  • Includes body: Has the logic, statements, and return value.
int add(int a, int b) {
    return a + b;
}

Microsoft Copilot

2025年9月2日星期二

快速鍵

To delete words one by one, first move the cursor to the end of the word you want to remove. Then, press and hold the Ctrl key, and then press the Backspace key.

Overloading functions

Function overloading in C++ is a powerful feature that allows you to define multiple functions with the same name, as long as they differ in their parameter list—either by number, type, or order of parameters. It’s a form of compile-time polymorphism, meaning the compiler decides which version of the function to call based on the arguments provided.

In C++, both float and double are used to represent floating-point numbers, but they differ significantly in precision, memory usage, and range.

double has a higher precision

In C++, the return statement is used inside a function to send a value back to the caller and to terminate the function’s execution. It’s a fundamental part of how functions communicate results.

In programming, the caller is the part of the code that invokes or calls a function.

invoke something (computing) to begin to run a program, etc.

#include <iostream>
using namespace std;

int add(int a, int b) {
    return a + b;  // 'add' is the callee
}

int main() {
    int result = add(5, 3);  // 'main' is the caller
    cout << "Result: " << result << endl;
    return 0;
}

In programming, a parameter is a variable used in a function or method definition to represent the input that the function expects when it's called. It's like a placeholder that gets filled with actual data—called an argument—during execution

// C++ example

void greet(std::string name) {  // 'name' is a parameter

    std::cout << "Hello, " << name << "!\n";

}

greet("Alice");  // "Alice" is the argument

static_cast in C++ is a type conversion operator used to explicitly convert one data type into another at compile time

std::to_string is a handy function in C++ used to convert numeric values into strings.


Microsoft Copilot

Hiking

cruise: DJ[kru:z] a journey by ship or boat, visiting different places, especially as a holiday

indulge something: to satisfy a particular desire, interest, etc.

pursue: DJ[pəˋsu:]

carpool: if a group of people carpool, they travel to work together in one car and divide the cost between them

awkward: difficult to deal with

mecca: a place that many people like to visit, especially for a particular reason

summit: the highest point of something, especially the top of a mountain

Surf-soaked is a term describing something completely covered or saturated with water from the ocean

wilderness: a large area of land that has never been developed or used for growing crops because it is difficult to live there

trek: DJ[trek] a long, hard walk lasting several days or weeks, especially in the mountains

push on: to continue with a journey or an activity

if skin chafes, or if something chafes it, it becomes painful because the thing is rubbing against it

raw: red and painful because the skin has been damaged

limp: to walk slowly or with difficulty because one leg is injured

humiliate: to make somebody feel ashamed or stupid and lose the respect of other people

wimp: a person who is not strong, brave or confident

unmitigated: ​used to mean ‘complete’, usually when describing something bad

gung ho: ​too enthusiastic about something, without thinking seriously about it, especially about fighting and war

Vancouver Island: a large island off the Pacific coast of Canada, in southwestern British Columbia. Its capital, Victoria, is the capital of British Columbia. It became a British Crown Colony in 1849, later uniting with British Columbia to join the Dominion of Canada.

graveyard: ​an area of land, often near a church, where people are buried

shipwrecked: ​having been sailing in a ship that was then lost or destroyed at sea

wash up: (of water) to carry something onto land

a building, road, etc. that is in a state of disrepair has not been taken care of and is broken or in bad condition

seaplane: a plane that can take off from and land on water

ford: to walk or drive across a river or stream

cove: a small bay

bog: (an area of) wet soft ground, formed of decayed (= destroyed by natural processes) plants

overgrown: ​(of gardens, etc.) covered with plants that have been allowed to grow wild and have not been controlled

slither: to move smoothly over a surface, like a snake

runoff: rain, water or other liquid that runs off land into streams and rivers

driftwood: wood that the sea carries up onto land, or that floats on the water

An avalanche cord is an old form of person locating device designed to enable people who have been buried by an avalanche to be rapidly located and rescued.

raft: a flat structure made of pieces of wood tied together and used as a boat or floating platform

relay: to receive and send on information, news, etc. to somebody


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

2025年8月26日星期二

Writing functions in C++

std::string name = "Alice";

A function prototype in C++ is a declaration of a function that tells the compiler about the function's name, return type, and parameters—without actually defining what the function does.

When we say "a function doesn't return a value" in C++, we mean that the function performs its task but doesn't give any result back to the part of the program that called it. Imagine you ask someone to turn off the lights. They do it, but they don’t hand you anything afterward—they just complete the action. That’s a void function.

string& in C++ means you're working with a reference to a std::string object.

In C++, a function is a reusable block of code that performs a specific task. When you call a function, it can either return a value or simply perform an action without returning anything.

In C++, an identifier is the name used to identify a variable, function, class, array, or any other user-defined element.

Microsoft Copilot

Free computer time

The better I got at coding, the more I wanted to do something real --- to write a program that might truly be useful to someone. It was the same urge I had a few years earlier when I'd realize that no matter how cool a picture I could draw of a bridge or a rocket, I could never build one in the real world. This was different. With a computer, I felt like anything I could image, I could create.

十三歲的比爾・蓋茲在編程方面越進步,就越想做一些真正的事情——寫一個或許能對某人真正有用的程式。他回憶道,這種欲望童年的感覺一樣,那時他意識到,無論小時候能畫出多麼有型的橋樑或火箭,都無法在現實世界中建造它們。但這次不同,有了電腦,他覺得任何他能想像的東西,都能創造出來。

meatloaf: meat, onions, etc. that are cut into very small pieces, mixed together and shaped like a loaf of bread and then baked

trivial: not important or serious; not worth considering

toll: the amount of damage or the number of deaths and injuries that are caused in a particular war, disaster, etc.

envision: to imagine what a situation will be like in the future, especially a situation you intend to work towards

airfield: an area of flat ground where military or private planes can take off and land

artillery: DJ[ɑ:ˋtiləri] large, heavy guns which are often moved on wheels

destroyer: a small fast ship used in war, for example to protect larger ships

offensive: attack

gauge: DJ[geidʒ] to measure something accurately using a special instrument

recuperate: to get back your health, strength or energy after being ill, tired, injured, etc.

fighter: a fast military plane designed to attack other aircraft

infantry: ​soldiers who fight on foot

odds: the degree to which something is likely to happen

peel off: to leave a group of vehicles, aircraft, etc. and turn to one side

curfew: a time when children must be home in the evening

wage: to begin and continue a war, a battle, etc.

demote: to move somebody/something to a lower position or rank, often as a punishment

owe: to have to pay somebody for something that you have already received or return money that you have borrowed

brag: to talk too proudly about something you own or something you have done

hardcore: highly committed in one's support for or dedication to something; denoting an extreme or intense example of something

banish: to order somebody to leave a place, especially a country, as a punishment

bypass: to ignore a rule, an official system or somebody in authority, especially in order to get something done quickly

lenient: not as strict as expected when punishing somebody or when making sure that rules are obeyed

summon: to order somebody to come to you

beard: DJ[biəd]

sternly: in a serious way that often shows that you do not approve of somebody/something; in a way that shows you expect somebody to obey you

berate: to criticize or speak angrily to somebody because you do not approve of something they have done

off-limits (to somebody) (of a place) where people are not allowed to go


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

www.merriam-webster.com

Translated with the help of AI and edited.

2025年8月21日星期四

Passing values to a function

It’s not that one is universally better --- pointers and references are different tools, each with its own strengths and trade‑offs. The “better” choice depends on your intent and the constraints of your code.

trade-off: the act of balancing two things that are opposed to each other

In C++, “taking an argument” usually means receiving input values into a function so it can work with them.

In C++, the return statement is how a function hands control (and optionally a value) back to its caller. Think of it as the function’s “exit door” — once return runs, the function stops executing immediately.

For void functions, you can:
- Omit return entirely, or
- Use return; to exit early without a value:

In main
- return 0; → program ended successfully
- Non‑zero values (e.g., return 1;) → indicate an error or abnormal termination to the operating system

In C++, the difference between taking arguments by address (pointers) and by reference is as follows:

By Address (Pointers):

You pass the memory address of the variable.
Syntax: Use an asterisk * in the function parameter and an ampersand & when calling the function.
Example: void swap(int *x, int *y) and called with swap(&a, &b).
Requires dereferencing inside the function using the * operator.

By Reference:

You pass the variable itself, but it acts as an alias to the original variable.
Syntax: Use an ampersand & in the function parameter.
Example: void swap(int &x, int &y) and called with swap(a, b).
No need for dereferencing inside the function.

Using references is generally safer and simpler because it avoids the need for explicit pointer manipulation.

Mainly by Microsoft Copilot

2025年8月19日星期二

fundamental code

A converted car dealership refers to a former car dealership building that has been repurposed for a different use.

pricey: expensive

Smashed Piñata Cakes only uses the highest-quality ingredients.

creep: to move with your body close to the ground; to move slowly on your hands and knees

sneak: to go somewhere secretly, trying to avoid being seen

scenic: having beautiful natural scenery

détente: an improvement in the relationship between two or more countries which have been unfriendly towards each other in the past

lenient: not as strict as expected when punishing somebody or when making sure that rules are obeyed

grateful: feeling or showing thanks because somebody has done something kind for you or has done as you asked

overstate: to say something in a way that makes it seem more important than it really is

sophomore: DJ[ˋsɔfəmɔ:]

A wartime decoy is a military tactic using deceptive devices to mislead the enemy about the location or strength of forces and equipment.

undervalue: to not recognize how good, valuable or important somebody/something really is

"Outliers: The Story of Success" is a non-fiction book written by Canadian writer Malcolm Gladwell.

deliberate: done on purpose rather than by accident

underwhelming: ​not impressing or exciting you at all

wield something: to have and use power, authority, etc.

mint: to make a coin from metal

slot machine: a machine that you put coins into to play a game in which you win money if particular pictures appear together on the screen; a similar game, played online

payout: a large amount of money that is given to somebody

aforementioned: mentioned before, in an earlier sentence

if there is a scarcity of something, there is not enough of it and it is difficult to obtain it

handful: a small number of people or things

snippet: a small piece of information or news

tantalizing: making you want something that you cannot have or do

stumble upon: to discover something/somebody unexpectedly

workaround: a way of working, especially with a piece of software, that avoids a particular problem but does not actually solve the problem

scrap: a small piece of something, especially paper, cloth, etc.

crumple: to press or crush something into folds; to become pressed, etc. into folds

dumpster: a large open container for putting old bricks, rubbish, etc. in. The Dumpster is then loaded on a lorry and taken away.

dregs: the last drops of a liquid, mixed with little pieces of solid material that are left in the bottom of a container

Polystyrene foam cups are often referred to as Styrofoam.

nimble: able to move quickly and easily

quarry: a place where large amounts of stone, etc. are dug out of the ground

terse: using few words and often not seeming polite or friendly

off-limits (to somebody) (of a place) where people are not allowed to go

laborious: taking a lot of time and effort

explicitly: clearly or directly, so that the meaning is easy to understand

novice: a person who is new and has little experience in a skill, job or situation

impenetrable: impossible to understand

Spacewar! is a space combat video game developed in 1962 by Steve Russell in collaboration with Martin Graetz, Wayne Wiitanen, Bob Saunders, Steve Piner, and others.

torpedo: a long, narrow bomb that is fired under the water from a ship or submarine and that explodes when it hits a ship, etc.

decipher: decipher something to convert something written in code into normal language

sprawl: to sit, lie or fall with your arms and legs spread out in a relaxed or careless way

Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

2025年8月17日星期日

Functions in C++

Modularity refers to the degree to which a system's components can be separated and recombined, often for increased flexibility and variety of use. It's a concept that can be applied across various disciplines, including engineering, computer science, and biology.

A simple example of a function in C++ that returns a value:

#include <iostream>

using namespace std;

int multiply(int x, int y) {

    return x * y;

}

int main() {

    int result = multiply(4, 5);

    cout << "The result is: " << result << endl;  // Output: The result is: 20

    return 0;

}

A function is a reusable block of code that performs a specific task. It can take inputs (parameters), do something, and optionally return a value.

Parameter: a variable in the function definition that receives a value

Argument: the actual value passed to the function when it is called

Use const in parameters when you don’t want them modified

A global function is defined outside of any class and can be accessed from anywhere in the file (or other files if declared properly).

Functions defined inside a class are called member functions. They operate on the data members of the class and can be either public or private.

In C++, a function signature is the part of a function declaration that includes the function name and the parameter types (but not the return type or parameter names).

In C++, the return type of a function specifies the type of value that the function will send back to the caller when it finishes executing.

What Is a Return Type?
It’s the data type declared before the function name that tells the compiler what kind of result to expect.

A function declaration tells the compiler, “This function exists, and here’s how it should be called.”

It does not contain the body of the function—just the signature and return type.

A function definition provides the actual implementation of a function. It includes:
- The return type
- The function name
- The parameter list
- The body (code that runs when the function is called)

A function prototype is a declaration that tells the compiler, “This function exists, and here’s how it should be called.”

It’s usually placed before main() or in a header file so the compiler knows about the function before it’s used.

Microsoft Copilot

2025年8月12日星期二

Quiz

In C++, a struct (short for "structure") is a user-defined data type that groups related variables under one name. It’s similar to a class, but by default, its members are public rather than private.

In C++, double is a primitive data type used to store floating-point numbers with double precision. That means it can represent decimal numbers with more digits and greater range than a float.

The line for (Resource& r : resources) is a range-based for loop in C++, and it means:
“For each Resource object r in the container resources, do something.”

The switch statement in C++ is a control structure used to execute different blocks of code based on the value of a variable—typically an int, char, or enum. It’s a cleaner alternative to multiple if-else statements when you're checking the same variable against many values.

for (declaration : container) {
    // loop body
}

Microsoft Copilot

Ranged for loops

traverse: cross

for (initialization; condition; update) {

    // Code to execute repeatedly

}


average += laptimes[i];

average = average + laptimes[i];


for (auto x : laptimes)

“For each element x in the container laptimes, do something with x.”
  • auto: Automatically deduces the type of x (e.g., double if laptimes is a vector)
  • x: A copy of each element in laptimes
  • :: Reads as “in” — like “for each x in laptimes


Microsoft Copilot

Testing a mainframe computer

commute: to travel regularly by bus, train, car, etc. between your place of work and your home

carpool: a group of car owners who take turns to drive everyone in the group to work, so that only one car is used at a time

cram: to learn a lot of things in a short time, in preparation for an exam

convertible: (of a car) having a roof that you can fold down or take off

savior: a person who rescues somebody/something from a dangerous or difficult situation

The French Resistance was a collection of groups that fought the Nazi occupation and the collaborationist Vichy regime in France during the Second World War.

decoy: a thing or a person that is used to trick somebody into doing what you want them to do, going where you want them to go, etc.

divert: to take somebody’s thoughts or attention away from something

jolt: to give somebody a sudden shock, especially so that they start to take action or deal with a situation

talk down to: to speak to somebody as if they were less important or intelligent than you

mainframe computer: a large, powerful computer, usually the center of a network and shared by many users

upmarket: in a way that involves buying or selling goods and services that are expensive and of high quality

entice: to persuade somebody/something to go somewhere or to do something, usually by offering them something

venture: a business project or activity, especially one that involves taking risks

upperclassman: (in the US) a male student in the last two years of high school or college

dealership: a business that buys and sells products, especially cars, for a particular company; the position of being a dealer who can buy and sell something

within earshot: near enough to hear somebody/something or to be heard

self-proclaimed: giving yourself a particular title, job, etc. without the agreement or permission of other people

anarchist: a person who believes that laws and governments are not necessary

hippie: a person who rejects the way that most people live in Western society, often having long hair, wearing brightly colored clothes and taking illegal drugs. The hippie movement was most popular in the 1960s.

hangout: a place where somebody lives or likes to go often

pepperoni: a type of spicy sausage

rigor: the fact of being strict or severe

afterthought: a thing that is thought of, said or added later, and is often not carefully planned

assurance: a statement that something will certainly be true or will certainly happen, particularly when there has been doubt about it

stipulation: a clear and definite statement that something must be done, or about how it must be done

paradoxically: in a way that seems strange, impossible or unlikely because it has two opposite features or contains two opposite ideas


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

2025年8月8日星期五

Computer room

    比爾·蓋茲喜歡電腦,電腦讓他思考。電腦對他馬虎的思維嚴酷無情。電腦要求他在邏輯上貫徹始終,在細節上小心注意。

    I loved how the computer forced me to think. It was completely unforgiving in the face of mental sloppiness. It demanded that I be logically consistent and pay attention to details.

disparate: so different from each other that they cannot be compared or cannot work together

rudimentary: dealing with only the most basic matters or ideas

ominously: in a way that suggests that something bad is going to happen in the future

elegance: the quality in a plan or an idea of being clever but simple

instantaneous: happening immediately

tic-tac-toe: a paper-and-pencil game for two players who take turns marking the spaces in a three-by-three grid, one with Xs and the other with Os.

infer: deduce

outstrip: to become larger, more important, etc. than somebody/something

sloppiness: ​the fact of showing a lack of care, thought or effort

rigorous: demanding that particular rules, processes, etc. are strictly followed

Algebra is a branch of mathematics that uses symbols, often letters, to represent numbers and their relationships in mathematical expressions and equations.

persevere: to continue trying to do or achieve something despite difficulties

coax: to persuade somebody to do something by talking to them in a kind and gentle way

asterisk: DJ[ˋæstərisk]

rack up: to collect something, such as profits or losses in a business, or points in a competition

blistering: done very fast or with great energy

gaggle: ​a group of noisy people

stoke: to make people feel something more strongly

mosh pit: the place, just in front of the stage, where the audience at a concert of rock music dances and jumps up and down

outdo: to do more or better than somebody else

indeterminate: that cannot be identified easily or exactly

put-upon: treated in an unfair way by somebody because they take advantage of the fact that you are kind or willing to do things

sophomore: ​a student in the second year of a course of study at a college or university

exploit: to treat a person or situation as an opportunity to gain an advantage for yourself

If someone is jockeying for position, they are using whatever methods they can in order to get into a better position than their rivals.

rival: a person, company or thing that competes with another in sport, business, etc.

hand-me-down: ​no longer wanted by the original owner

A Renaissance DJ[rəˋneisəns] man is a term for someone who is knowledgeable, educated, and proficient in many different fields, excelling in a variety of areas.

ICBM: Intercontinental Ballistic Missile

muttonchops: long hair growing down each side of a man's face

goad: stimulate

bait: a person or thing that is used to attract somebody in order to catch them or make them do what you want

gadget: DJ[ˋgædʒit] a small tool or device that does something useful

cerebral: relating to the mind rather than the feelings

foursome: a group of four people taking part in a social activity or sport together

leveler: an event or a situation that makes everyone equal whatever their age, importance, etc.

RAND is a nonprofit institution that helps improve policy and decision-making through research and analysis.

kooky: strange or crazy

hindsight: the understanding that you have of a situation only after it has happened and that means you would have done things in a different way

de facto: (from Latin, formal) existing as a fact although it may not be legally accepted as existing

overseer: a person or an organization that is responsible for making sure that a system is working as it should

thrilled: very excited and pleased

poke: to push something somewhere or move it in a particular direction with a small quick movement

squabble: ​a noisy argument about something that is not very important

wrath: extreme anger

tongue-in-cheek: not intended seriously; done or said as a joke

laissez-faire: the policy of leaving things to take their own course, without interfering

oversight: the fact of making a mistake because you forget to do something or you do not notice something

rebuff: rebuff something to refuse a friendly offer, request or suggestion in an unkind way

Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

www.merriam-webster.com

Some explanations are from Google AI Overview.

2025年8月5日星期二

Reference in C++

#include <iostream>

void incrementByReference(int& ref) {
    ref++;  // Directly increments the original variable
}

int main() {
    int value = 20;
    int& rValue = value;  // Declare a reference bound to 'value'
   
    std::cout << "Before: " << value << "\n";  // Prints 20
   
    incrementByReference(rValue);
   
    std::cout << "After:  " << value << "\n";  // Prints 21
   
    // References must be initialized and cannot be reseated
   
    return 0;
}

References in C++ act as true aliases for existing objects.

Once you bind a reference to an object, any operation through that reference directly

affects the original. There’s no extra indirection or separate storage - think of the

reference as a permanent nickname for the object.


Ideal for function parameters when you want to modify the caller’s variable.

value is the caller’s variable (actual parameter) in the main() function.

Microsoft and GitHub Copilot

Pointer in C++

#include <iostream>

void incrementByPointer(int* ptr) {
    if (ptr) {
        (*ptr)++;  // Dereference pointer, then increment the pointee
    }
}

Line 1. Function Signature - Return type is void, so nothing comes back to the caller. - Parameter is int* ptr, a pointer to an int.

Line 2. Null Check
Guarding against a null pointer prevents undefined behavior if someone accidentally calls
incrementByPointer(nullptr).

Line 3. Dereference & Increment
- The parentheses ensure you dereference ptr first, yielding the int it points to.
- The ++ then increments that int in place.
Note: Writing ptr++ would advance the pointer itself, not the value it points to.

int main() {
    int value = 10;
    int* pValue = &value;  // Declare a pointer and take the address of 'value'
   
    std::cout << "Before: " << value << "\n";  // Prints 10
   
    incrementByPointer(pValue);
   
    std::cout << "After:  " << value << "\n";  // Prints 11

When you see both ptr and pValue in the code, they’re actually two separate pointer variables that refer

to the same int in memory, but they live in different scopes and serve different roles.

Roles and Scope

    pValue

Declared in main().

Holds the address of value.

Its lifetime is the entire execution of main.

You use it to pass &value into functions or perform pointer arithmetic in main.

    ptr

Declared as a parameter in incrementByPointer(int* ptr).

Receives a copy of pValue (the address).

Its lifetime is the duration of the function call.

You use it inside incrementByPointer to modify the pointee.


The literal "\n" represents a single newline character in C++ strings.

When inserted into an output stream, it moves the cursor to the beginning of the next line.

    // Pointer arithmetic example
    int arr[] = {1, 2, 3};
    int* pArr = arr;  // Points to the first element
    std::cout << "Second element via pointer arithmetic: "
              << *(pArr + 1) << "\n";  // Prints 2
   
    return 0;
}

arr decays to int* pointing at the first element.

pArr + 1 advances the pointer by one int (4 bytes on most platforms).

The dereference *(pArr+ 1) yields the second element, exactly like arr[1].

Output:

Second element via pointer arithmetic: 2


Microsoft Copilot

His friend

unruly: not readily ruled, disciplined, or managed

cleft lip: a birth defect characterized by one or more clefts in the upper lip resulting from failure of the embryonic parts of the lip to unite

impediment: a problem, for example a stammer, that makes it more difficult for somebody to speak, hear, etc.

stammer: a problem that somebody has in speaking in which they repeat sounds or words or often stop, before saying things correctly

orthodontia: the treatment of irregularities in the teeth and jaws.

slackly: loosely

A Unitarian minister is a religious leader in the Unitarian or Unitarian Universalist (UU) tradition.

clique: a small group of people who spend their time together and do not allow others to join them

pursue: to do something or try to achieve something over a period of time

tumultuous: involving many difficulties and a lot of change and often violence

assassination: DJ[ə͵sæsiˋneiʃən] the murder of an important or famous person, especially for political reasons

convention: a large meeting of the members of a profession, a political party, etc.

bow out: to stop taking part in an activity, especially one in which you have been successful in the past

vying: vie: to compete strongly with somebody in order to obtain or achieve something

vehemently: ​in a way that shows very strong feelings, especially anger

devour: to read or look at something with great interest and enthusiasm

senator: a member of a senate

senate: one of the two groups of elected politicians who make laws in some countries, for example in the US, Australia, Canada and France. The Senate is smaller than the other group but higher in rank. Many state parliaments in the US also have a Senate.

decry: to strongly criticize somebody/something, especially publicly

conspiracy theory: the belief that a secret but powerful organization is responsible for an event

plot: a secret plan made by a group of people to do something wrong or illegal

idolize: to admire or love somebody very much, possibly too much

LBJ: Lyndon B. Johnson

liberal: a person who supports individual freedom and rights, democracy and free enterprise (= businesses competing against each other with little government control)

carpet: to cover something with a thick layer of something

canvass:  to ask people to support a particular person, political party, etc., either by going around an area and talking to people or by phoning them

flyer: a small sheet of paper that advertises a product or an event and is given to a large number of people

stake out: ​to watch a place secretly, especially for signs of illegal activity

pudgy: ​slightly fat

bump into: (informal) to meet somebody by chance

take on: to begin to have a particular quality, appearance, etc.

machination: a secret and complicated plan

obsess: to completely fill your mind so that you cannot think of anything else, in a way that is not reasonable or normal

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

intrigue: to make somebody very interested and want to know more about something

disquisition: a long complicated speech or written report on a particular subject

ding: to speak with tiresome reiteration

shortcoming: ​a fault in somebody’s character, a plan, a system, etc.

outline: to give a description of the main facts or points involved in something

slog: a hard journey

rugged: (of the landscape) not level or smooth and having rocks rather than plants or trees

slosh: to move around making a lot of noise or coming out over the edge of something

inundate: overflow

fled: flee: to leave a person or place very quickly, especially because you are afraid of possible danger

aside from: except for

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

envision: to imagine what a situation will be like in the future, especially a situation you intend to work towards

Douglas MacArthur (26 January 1880 - 5 April 1964) was an American general who served as a top commander during World War II and the Korean War.

dissect something: to study something closely and/or discuss it in great detail

decipher: to succeed in finding the meaning of something that is difficult to read or understand

"Lucy in the Sky with Diamonds" is a song by the English rock band the Beatles, featured on their 1967 album Sgt. Pepper's Lonely Hearts Club Band.

marvel at: to show or experience great surprise or admiration

flaw: a mistake in something that means that it is not correct or does not work correctly

appointee: a person who has been chosen for a job or position of responsibility

clout: DJ[klaut] power and influence

prodigious: ​very large or powerful and causing surprise; impressive

A clapboard is a type of siding, traditionally made of long, thin, overlapping wooden boards, used to cover the exterior of buildings.

A cog railway is a type of railway that uses a toothed rack rail, usually between the running rails, to climb steep slopes.

hunch over: to bend the top part of your body forward and raise your shoulders and back

rotary: moving in a circle around a central fixed point

A teletype machine, also known as a teletypewriter or teleprinter, is an electromechanical device that transmits and receives typed messages over communication channels.

In computing, time-sharing refers to a method of sharing a computer's resources, typically the CPU, among multiple users or processes concurrently.

concurrently: at the same time

parcel out: to divide something into parts or between several people

caliber: the quality of something, especially a person’s ability

An ordained minister is a member of the clergy who has been formally recognized and authorized by a religious institution to perform religious rites and ceremonies.

freewheeling: not concerned about rules or the possible results of what you do

aeronautical: connected with the science or practice of building and flying aircraft

avid: very enthusiastic about something (often a hobby)

sabbatical: a period of time when somebody, especially a teacher at a university, is allowed to stop their normal work in order to study or travel

sacred: very important and treated with great respect; that must not be changed or challenged

infamous: notorious

trek: a long, hard walk lasting several days or weeks, especially in the mountains

intrepid: very brave; not afraid of danger or difficulties

lease: a legal agreement that allows you to use a building, a piece of equipment or some land for a period of time, usually in return for rent

rummage sale: a sale of old or used clothes, etc. to make money for a church, school or other organization

cutting-edge: at the newest, most advanced stage in the development of something

amusing: funny and giving pleasure

hunch: a feeling that something is true even though you do not have any evidence to prove it

Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

www.merriam-webster.com

Some explanations are from Google AI Overview.

2025年7月30日星期三

New School

station wagon: an automobile that has a passenger compartment which extends to the back of the vehicle, that has no trunk, that has one or more rear seats which can be folded down to make space for light cargo, and that has a tailgate or liftgate

tailgate: the door that opens upwards at the back of a car (called a hatchback) that has three or five doors

liftgate: a rear panel that opens upward

A college feeder is a school, typically a high school, that sends a disproportionately high number of students to a particular college or university, or a specific type of higher education institution.

disproportionately: in a way that is too large or too small when compared with something else

abolish: abolish something to officially end a law, a system or an institution

While A Separate Peace has not been banned, it has been challenged six times between 1980 and 1996 in six different counties. Most of the complaints about the book cite offensive language; several complaints also include homosexual themes and negative attitudes expressed by characters.

county: one of a number of areas that some countries are divided into, each with its own local government

clip: to cut something with scissors or shears, in order to make it shorter or neater; to remove something from somewhere by cutting it off

upperclassman: ​(in the US) a male student in the last two years of high school or college

fame: the state of being known and talked about by many people

championship: a competition to find the best player or team in a particular sport

forestry: the science or practice of planting and taking care of trees and forests

the ropes [plural]: the fence made of rope that is around the edge of the area where a boxing or wrestling match takes place

A glee club is a group of people who sing together, often in a school or university setting.

shtick: a style of humor that is typical of a particular performer

goof-off: ​a person who avoids work or responsibility

fellowship: (formal) a feeling of friendship between people who do things together or share an interest

depiction: the act of showing somebody/something in a particular way in words or pictures, especially in a work of art

loner: a person who is often alone or who prefers to be alone, rather than with other people

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

obnoxious: extremely unpleasant, especially in a way that offends people

Avid generalist refers to someone who is highly skilled and knowledgeable across a broad range of subjects or fields, rather than specializing in a single area.

crew cut: a hairstyle in which the hair is cut very short

pump-fake: in football and basketball, an action in which a player deceives their opponent by pretending to throw the ball in a particular direction, or by pretending to move in a particular direction

clown: a person that you think is bad because they act in a stupid way

sting: to make somebody feel angry or upset

redeem somebody/something: to make somebody/something seem less bad

crib: to dishonestly copy work from another student or from a book

deluge: a large number of things that happen or arrive at the same time

opus: an important piece of literature, etc., especially one that is on a large scale

exhortation (to do something): an act of trying very hard to persuade somebody to do something

oblige: DJ[əˋblaidʒ] to help somebody by doing what they ask or what you know they want

extensive: including or dealing with a wide range of information


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

www.merriam-webster.com

Some explanations are from Google AI Overview.

2025年7月29日星期二

20 mg Simvastatin q.d.

Over-the-counter (OTC) medicines are medications that can be purchased without a prescription from a healthcare professional. They are used to treat a variety of common ailments (minor illness) and their symptoms. While readily available, it's crucial to use them safely and responsibly.

In Hong Kong, most cholesterol lowering drugs can only be obtained from pharmacy with a prescription. They should be used under close supervision by healthcare professionals.

for loops

In C++, vector<int> is a dynamic array from the Standard Template Library (STL) that stores integers. Unlike regular arrays, vectors can grow or shrink in size during runtime.

for (initialization; condition; update) {
    // Code to execute in each iteration
}

average += laptimes[i];
is equivalent to
average = average + laptimes[i];

average/= laptimes.size();
is equivalent to
average = average / laptimes.size();

Microsoft Copilot

Contemporary Club

run-up (to something) a period of time leading up to an important event; the preparation for this

orchestrate something: to organize a complicated plan or event very carefully or secretly

dessert: DJ[diˋzə:t]

masterful: showing great skill or understanding

wrestle: to struggle physically to move or manage something

horse around: to play in a way that is noisy and not very careful so that you could hurt somebody or damage something

get off the hook: to manage to get out of the awkward situation you are in without being punished or blamed

awkward: difficult to deal with

weave: to put facts, events, details, etc. together to make a story or a closely connected whole

a jolt of electricity: a sudden, brief, and often painful sensation caused by the flow of electrical current through the body

devise something: to invent something new or a new way of doing something

edge up: to approach or move toward a target little by little

patent: an official right to be the only person to make, use or sell a product or an invention; a document that proves this

downtown: ​in, towards or typical of the center of a city, especially its main business area

fictitious: invented by somebody rather than true

contemporary: belonging to the present time

Gondoliers are more than just boat men. They are the keepers of a tradition that has been passed down from generation to generation.

brim: the top edge of a cup, bowl, glass, etc.

straw: stems of wheat or other grain plants that have been cut and dried. Straw is used for making mats, hats, etc., for packing things to protect them, and as food for animals or for them to sleep on.

think tank: a group of experts who provide advice and ideas on political, social or economic issues

spin out: ​to make something last as long as possible

leash: something that restrains : the state of being restrained

in retrospect: thinking about a past event or situation, often with a different opinion of it from the one you had at the time

waver: to be or become weak or unsteady

replica: ​a very good or exact copy of something

Fiddler on the Roof is a musical with music by Jerry Bock, lyrics by Sheldon Harnick, and book by Joseph Stein, set in the Pale of Settlement of Imperial Russia in or around 1905.

in the fall: in autumn

tuition: the money that you pay to be taught, especially in a college or university

tank:  tank (something) (North American English, sport) to lose a game, especially deliberately

deliberately: done in a way that was planned, not by chance

prevail: (of ideas, opinions, etc.) to be accepted, especially after a struggle or an argument


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

www.merriam-webster.com

Some explanations are from Google Search Engine.

2025年7月25日星期五

Observing adults

confer: to discuss something with somebody, in order to exchange opinions or get advice

gist: the main or general meaning of a piece of writing, a speech or a conversation

recount: to tell somebody about something, especially something that you have experienced

stunned: very surprised or shocked

dash: ruin

stake out: to clearly mark the limits of something that you claim is yours

intuitively: by using your feelings rather than by considering the facts

give in: to admit that you have been defeated by somebody/something

ease up: to become less strong, unpleasant, etc.

come out: to be produced or published

choke up: to find it difficult to speak, because of the strong emotion that you are feeling

strip something out: to ignore particular numbers or facts in a situation in order to understand what is really important

brink: if you are on the brink of something, you are almost in a very new, dangerous or exciting situation

intrigued: DJ[inˋtri:gd] very interested in something/somebody and wanting to know more about it/them

animatedly: in a way that shows interest and energy

consequential: happening as a result or an effect of something

Dictaphone: a small machine used to record people speaking, so that their words can be played back later and written down

Xerox: a process for producing copies of letters, documents, etc. using a special machine

decipher: to succeed in finding the meaning of something that is difficult to read or understand

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

peek: to look at something quickly and secretly because you should not be looking at it

meticulous: paying careful attention to every detail

deposition: a formal statement, taken from somebody and used in court

oversee: to watch somebody/something and make sure that a job or an activity is done correctly

coolheaded: calm; not showing excitement or nerves

unwavering: not changing or becoming weaker in any way

metrics [plural]: a set of numbers or statistics used for measuring something, especially results that show how well a business, school, computer program, etc. is doing

accomplishment: an impressive thing that is done or achieved after a lot of work

In the card game bridge, a bridge partner refers to the other player on your team. 


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

www.merriam-webster.com

Some explanations are from Google AI Overview

2025年7月23日星期三

Selecting the right while loop

while (condition){
    // Code to execute
}

do{
    // Code to execute
}while (condition);

The do...while loop is executed at least once.

negate: to stop something from having any effect

The exclamation mark ! is the logical NOT operator. It inverts a boolean value.

getline is a handy function in C++ for reading a whole line of text, especially when you're dealing with strings that might include spaces.

getline(cin, userInput); // reads full line including spaces

std::getline(std::cin, playerName);

using std::getline from the <string> header to read a full line of input into playerName

\n is a newline character used in C++.

do{
    // Code to execute
}while (choice != 3);

repeats until they select option 3

Microsoft Copilot

2025年7月22日星期二

While loops

In C++, the auto keyword is used for type inference, which means the compiler automatically deduces the variable's type from its initializer. It’s incredibly handy when dealing with complex types or simply to make your code cleaner.

Pointer = next(Pointer, 1);

Pointer = std::next(Pointer, 1);

++Pointer;

Think of an iterator as a pointer-like object that lets you access and traverse elements of a container. It abstracts away the underlying structure, making your code flexible and reusable.

The keyword do in C++ is most commonly seen as part of the do...while loop—a control structure that executes code at least once before checking a condition. It's great when you want to ensure a block of code runs before validating any exit condition.

do {
    // Code to execute
} while (condition);

++count: increments count before its value is used
count++: increments count after its value is used

In C++, .size() is a method used to retrieve the number of elements in a container from the Standard Template Library (STL). It’s simple but powerful when you need to know the container’s current size.

std::vector<int> scores = {1, 2, 3, 4, 5};

I declared and initialized a std::vector<int> named scores with the values {1, 2, 3, 4, 5}

std::cout << "First score: " << scores[0] << std::endl;

scores.push_back(6);

std::cout << "Total scores: " << scores.size() << std::endl;

Microsoft Copilot

廣袤

「廣袤」的意思是土地的面積,東西向稱為「廣」,南北向稱為「袤」。 也可以引申為開闊、寬廣的意思。 例如,可以說「這片草原廣袤無垠」,表示草原非常廣闊,望不到邊際。 「廣袤」也可以用來形容其他空間的遼闊,例如「天空廣袤」。粵音同「貿」。

Google AI

Counseling

Without being prescriptive, Dr. Cressey helped me see that my parents loved me; I wouldn't be under their roof forever; they were actually my allies in terms of what really counted; it was absurd to think that they had done anything wrong.

在不採取說教方式的情況下,

Dr. Cressey幫助作者看清父母是愛他的;

他終究不會永遠住在父母的屋簷下;

在真正重要的事情上,他們其實是作者的盟友;

要認為他們做錯了什麼簡直荒謬。

進一步的闡釋︰

雖然作者暫時受制於父母的安排,但這並不會成為終身桎梏,而是一段生命必經的過程。

由抗拒到理解,作者認清真正值得追求的目標時,父母成了最堅實的後盾,而非阻力。

sexist: treating other people, especially women, unfairly because of their sex or making offensive remarks about them

An airline hostess, also known as a flight attendant or cabin crew, is a member of the aircrew responsible for passenger safety and comfort during flights.

astronaut: DJ[ˋæstrənɔ:t]

doggedly: in a way that shows that you are determined and do not give up easily

unnerved: to make somebody feel nervous or frightened or lose confidence

In baseball, a wild pitch occurs when a pitcher throws the ball to the batter in a way that the catcher cannot control with ordinary effort, and as a result, a base runner advances to the next base. 

cohort: a group of people who share a common feature or aspect of behavior

A growth spurt is a period of rapid physical development, primarily characterized by an increase in height and weight.

galumph: to move in a heavy, careless or noisy way

Coming of age refers to the transition from childhood to adulthood.

thrill: a strong feeling of excitement or pleasure; an experience that gives you this feeling

goof around: to spend your time doing silly or stupid things

stint: a period of time that you spend working somewhere or doing a particular activity

The brass section of an orchestra or band consists of the musicians who play brass instruments.

trombone: a large brass musical instrument that you blow into, with a sliding tube used to change the note

lug: to carry or drag something heavy with a lot of effort

circular: a letter, notice or advertisement that is sent to a large number of people at the same time

venture: ​a business project or activity, especially one that involves taking risks

toss: to throw something lightly or carelessly

porch: a small area at the entrance to a building, such as a house or a church, that is covered by a roof and often has walls

dreaded: causing fear

murmur: to say something in a soft quiet voice that is difficult to hear or understand

spank: to hit somebody, especially a child, several times on their bottom as a punishment

disciplinarian: ​a person who believes in using rules and punishments for controlling people

intimidating: frightening in a way that makes a person feel less confident

Towering stature refers to someone or something having a very tall or impressive height. It can also be used metaphorically to describe someone or something that is outstanding in terms of importance, influence, or power.

intrinsically: ​in a way that belongs to or is part of the real nature of somebody/something

punitive: intended as punishment

collaborative: involving, or done by, several people or groups of people working together

suck up: to try to please somebody in authority by praising them too much, helping them, etc., in order to gain some advantage for yourself

smart aleck: a person who thinks they are very clever and likes to show people this in an annoying way

snap: to speak or say something in an impatient, usually angry, voice

turmoil: a state of great worry in which everything is confused and nothing is certain

Plaster walls are a construction detail where a layer of plaster is applied to a surface, typically walls and ceilings, to create a smooth, finished appearance. Plaster can be used for both decorative and protective purposes, and is often applied over brick, concrete, or other materials.

hard-pressed: having a lot of problems, especially too much work, and too little time or money

disarming: making people feel less angry or likely to suspect somebody than they were before

lead up to: to be an introduction to or the cause of something

sparingly: ​in a way that is careful to use or give only a little of something

hindsight: the understanding that you have of a situation only after it has happened and that means you would have done things in a different way

avid: very enthusiastic about something (often a hobby)

Carl Jung was a Swiss psychologist and psychiatrist who founded analytic psychology.

intriguing: very interesting because of being unusual or not having an obvious answer

prescriptive: telling people what should be done

absurd: extremely silly; not logical and sensible

dispense with: ​to stop using somebody/something because you no longer need them or it

belittle: ​to stop using somebody/something because you no longer need them or it


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

Some explanations are came from Google AI and Microsoft Copilot.