Input & Output

Your programs need to get data from users and display results. I will show you how to read different types, handle errors, and format output.

48 lessons
190 min

Lessons

1. Intro

The Goal

4m

2. Reading Input with cin

The extraction operator

4m

3. How cin Works

Reading from the input buffer

4m

4. Reading int Values

Integer input

4m

5. Reading double Values

Floating-point input

4m

6. Quiz: Reading Input

Input operations

2m1 problems

7. Reading char Values

Character input

4m

8. Quiz: Basic Input

Test your understanding

3m1 problems

9. Reading Multiple Values

Chained extraction

4m

10. Reading Multiple Values

Sequential reads

4m

11. Input Order Matters

Reading in correct sequence

4m

12. Quiz: Multiple Inputs

Test your understanding

3m1 problems

13. Reading Strings with cin

String extraction

4m

14. The Whitespace Problem

Spaces terminate extraction

4m

15. Reading Full Lines with getline

Reading entire lines

4m

16. Mixing cin and getline

Common mixing error

4m

17. Challenge: Temperature Converter

Apply a formula

5m1 problems

18. Quiz: Reading full lines

Reading full lines

3m1 problems

19. Fixing the Newline Problem

Discarding leftover characters

4m1 problems

20. Input Validation Basics

Why inputs fail

4m

21. When Input Fails

Understanding failure state

4m

22. Quiz: Knowledge check

Knowledge check

3m1 problems

23. Checking Input State

Detecting read errors

4m

24. Formatting Output

Controlling output appearance

4m

25. Setting Precision

Controlling decimal digits

4m

26. Quiz: Counter-based loop

Counter-based loop

3m1 problems

27. Fixed vs Scientific

Notation styles

4m

28. Setting Width

Field width control

4m

29. Quiz: Conditional execution

Conditional execution

3m1 problems

30. Common Input Patterns

Reading unknown quantity

4m

31. Reading Until EOF

Processing all input

4m

32. Reading Until Sentinel

User-controlled termination

4m

33. Problem - Calculate Average

Practice reading and computing

4m1 problems

34. Problem - Echo Input

Practice string input

4m1 problems

35. Problem - Watermelon

First CF problem

4m1 problems

36. Watermelon - The Idea

Main approach

4m

37. Watermelon - Algorithm

How to solve

4m

38. Quiz: Knowledge check

Knowledge check

3m1 problems

39. Watermelon - Implementation

Complete solution

7m1 problems

40. Lessons from Watermelon

What we learned

4m

41. Problem - Way Too Long Words

Multiple test cases

4m1 problems

42. Way Too Long Words - The Idea

Main approach

4m

43. Reading Multiple Inputs

Handle n test cases

4m

44. Quiz: Large integers

Large integers

3m1 problems

45. Way Too Long Words - Algorithm

How to solve

4m

46. Way Too Long Words - Implementation

Complete solution

7m1 problems

47. Lessons from Way Too Long Words

What we learned

4m

48. Section Recap

What we learned

5m

Ready to start learning?

Access all 48 lessons with interactive content and progress tracking.