跳到主要内容

第一个程序 » 练习

来自多路复用器星球的 Mux 大人降落地球了!这是一场灾难性的到来——传送门风暴、狂暴的外星生物、电磁脉冲等等,全球基础设施都瘫痪了。尽管如此,Mux 大人仍要求看到人类最先进的技术。虽然所有基于硅的计算机都因辐射浪涌而无法运行,但30年代的旧机械电传打字机仍然完全正常工作。

Old Teletype Machine

编写一个 C++ 程序,使用 std::cout 向 Mux 大人发送消息。我们的工程师已将输出流连接到市中心仅存的一条电报线。

您的消息应如下所示

Hello Lord Mux!

I am "YOUR NAME", a representative for the Planet Earth and all of Humanity.

I have been sent to you to demonstrate our most advanced technology.

Sadly, your unexpected arrival has destroyed our computing and manufacturing abilities.

I bring to you an old "teletype" made nearly 100 years ago. It is printing the message you are reading now.

It can even do math! Look: (42 - 37) * (42 + 37) = 395

Give us some time, we can make something even cooler!

(注意:不要硬编码数学方程式的答案,您应该使用上面学到的知识!)

第一个程序 » 练习

来自多路复用器星球的 Mux 大人降落地球了!这是一场灾难性的到来——传送门风暴、狂暴的外星生物、电磁脉冲等等,全球基础设施都瘫痪了。尽管如此,Mux 大人仍要求看到人类最先进的技术。虽然所有基于硅的计算机都因辐射浪涌而无法运行,但30年代的旧机械电传打字机仍然完全正常工作。

Old Teletype Machine

编写一个 C++ 程序,使用 std::cout 向 Mux 大人发送消息。我们的工程师已将输出流连接到市中心仅存的一条电报线。

您的消息应如下所示

Hello Lord Mux!

I am "YOUR NAME", a representative for the Planet Earth and all of Humanity.

I have been sent to you to demonstrate our most advanced technology.

Sadly, your unexpected arrival has destroyed our computing and manufacturing abilities.

I bring to you an old "teletype" made nearly 100 years ago. It is printing the message you are reading now.

It can even do math! Look: (42 - 37) * (42 + 37) = 395

Give us some time, we can make something even cooler!

(注意:不要硬编码数学方程式的答案,您应该使用上面学到的知识!)