code programming

From Python to C++ — and Why the Difference Matters

You already have a working Python program. You are going to write it again in C++, line for line, and reproduce its worst bug on purpose. Along the way you find out why the compiler wants to know the size of the box before you put anything in it, and why the error now arrives before the program has even run.

  • trending_upIntermediate
  • schedule6h 15m
  • menu_book12 บทเรียน
  • publicEnglish
  • workspace_premiumBasic
From Python to C++ — and Why the Difference Matters

บทสรุป

This is not a C++ course for people who have never programmed. It is a second language for someone who has a first one, taught entirely by contrast. Python let you write `age = 11` and never asked what `age` was. C++ makes you declare it, and it makes you choose between six kinds of box before you have put anything in one. That is annoying for about two hours and then it is the reason your program runs fast enough to finish inside a four-second limit. The spine of the segment is a port. You take the small question-and-answer script from the Python track — the one that asks your name, asks your favourite food and judges the answer — and you rebuild it in C++ a line at a time. Then you type your answer with a trailing space and it fails in exactly the same way it failed in Python. That is the point of the whole exercise. The trailing space was never a Python bug. It was an input bug, and it followed you. The last module points at USACO Bronze: what a competitive problem actually looks like on paper, how the input arrives, why the array is fixed at a thousand before you have read a single number, and why nearly everyone in that room is writing C++.

เนื้อหาคอร์ส · 4 โมดูล

lockปลดล็อกด้วยการเข้าถึง
  1. 01 The Box Has a Size
    3 บทเรียน·1h 22m

    Python worked out what you meant. C++ makes you say it in advance, once, and then holds you to it for the rest of the program. Everything in this module is that one trade, examined.

  2. 02 Where the Error Arrives
    3 บทเรียน·1h 23m

    Python runs a line, then reads the next one. C++ reads the whole file, refuses it if any part of it is wrong, and only then produces something you can run. Nothing you wrote today runs until all of…

  3. 03 The Port
    3 บทเรียน·1h 55m

    Port it, do not rewrite it. Same order, same questions, same output. If you improve it while you translate it you will not be able to tell which differences are C++ and which are you.

  4. 04 The Shape of a Contest Problem
    3 บทเรียน·1h 35m

    A contest problem is a contract. Input format, output format, constraints, limits. Read the constraints before you think about the algorithm — they are telling you which algorithm is allowed.

คำถามที่ถูกถามบ่อย

ฉันจะเรียนรู้อะไรใน From Python to C++ — and Why the Difference Matters
You already have a working Python program. You are going to write it again in C++, line for line, and reproduce its worst bug on purpose. Along the way you find out why the compiler wants to know the size of the box before you put anything in it, and why the error now arrives before the program has
ฉันต้องมีประสบการณ์มาก่อนหรือไม่
แนะนำให้มีความรู้ก่อนหน้านี้ก่อนเริ่มต้น From Python to C++ — and Why the Difference Matters
From Python to C++ — and Why the Difference Matters ใช้เวลานานเท่าไหร่
From Python to C++ — and Why the Difference Matters มี 4 โมดูล และ 12 บทเรียน คุณเรียนรู้ได้ตามความเร็วของคุณเอง
ฉันจะเข้าถึงได้อย่างไร
From Python to C++ — and Why the Difference Matters รวมอยู่กับสมาชิกแบบจ่ายเงินใด ๆ

เพิ่มเติมใน การเขียนโปรแกรม

Binary, Hex and Data Units
Beginner Binary, Hex and Data Units The topic that costs more marks than any other on the paper, taught by hand. Bits and bytes, binary and hex in all six directions, the 1000-versus-1024 trap, file sizes, transmission times, overflow, two's complement and character sets. Every module ends in a timed drill marked the way an examiner marks it.
Python From a White Sheet
Beginner Python From a White Sheet ลำดับที่แน่นอนที่นักเรียนเก้าคนได้เดินผ่านแล้ว จากไฟล์เปล่าไปจนถึงโปรแกรมที่ถามคำถาม ตรวจสอบคำตอบ และปฏิเสธข้อมูลไม่ดี ไม่มีประสบการณ์การเขียนโปรแกรมก่อนหน้านี้ ไม่มีคณิตศาสตร์ คุณจะทำให้มันพัง ซ้ำแล้วซ้ำเล่า โดยจงใจ
First Program — Scratch for ages 5–9
Beginner First Program — Scratch for ages 5–9 Nine Scratch blocks, three sessions of about twenty-five minutes, and one small program a child of five to nine builds themselves. Written for the parent sitting beside them: what to click, what they will get stuck on, what to say when it goes wrong, and when to keep your hands off the mouse.
AI Without the Hype
Beginner AI Without the Hype โมเดลกำลังทำอะไรอยู่เมื่อตอบคำถามของคุณ เหตุใดจึงเกิดผลลัพธ์ที่ดูเหมือนการคิดขึ้นมา เหตุใดจึงสร้างการอ้างอิงที่ไม่มีอยู่ และกลไกต้นทุนที่เกือบไม่มีใครอธิบาย: แชตจะส่งการสนทนาทั้งหมดใหม่ในทุกครั้งที่กดส่ง คุณจะต้องคำนวณมันเองด้วย
IGCSE และ GCSE Computer Science — ทฤษฎีที่ได้คะแนนจริงๆ
Intermediate IGCSE และ GCSE Computer Science — ทฤษฎีที่ได้คะแนนจริงๆ ส่วนทฤษฎีของข้อสอบ สอนให้คุณจำได้ผ่านห้องสอบ โครงสร้างหน่วยความจำและสิ่งที่เกิดขึ้นตอนเริ่มเปิดเครื่อง Compilers, interpreters และ assemblers รวมคำตอบที่ฟังดูถูกต้องแต่ได้ศูนย์คะแนน Databases จากสเปรดชีตขึ้นไปถึง keys และ normalisation DNS และเส้นทางเต็มจากการกดเข้าถึงการเห็นหน้าเว็บ Software ระบบและส่วนจริยธรรมและกฎหมายที่เป็นสิบคะแนนที่ง่ายที่สุดในข้อสอบ
Programming for the Exam — Python Answers That Score
Intermediate Programming for the Exam — Python Answers That Score The programming half of the paper, taught at exam pitch. Pseudocode translated both ways, because the mark scheme is written in a notation nobody practises. Trace tables done column by column, including the ones with a loop and a condition inside it. Linear and binary search, bubble and insertion sort, what each costs and the comparison questions boards love. Validation against verification, and the boundary test data everybody forgets. Procedures against functions, and a systematic method for finding your own error with four minutes left.