cstdio


1. Basic Input and Output

#include <cstdio>

int main() {
  int x;
  printf("Enter a number: ");
  scanf("%d", &x);
  printf("You entered: %d\n", x);
}

2. Formatted Output

#include <cstdio>

int main() {
  double x = 3.14159;
  printf("Pi to 5 decimal places: %.5f\n", x);
}

3. File Input and Output

#include <cstdio>

int main() {
  FILE *file = fopen("test.txt", "w");
  fprintf(file, "Hello, world!\n");
  fclose(file);
}

4. Formatted File Input and Output

5. Reading and Writing Binary Data

6. Random Access File I/O

7. Standard Input, Output, and Error Streams

8. Terminal Control

9. Input Validation

10. Menu-Driven Programs

11. String Input and Output

12. Character Input and Output

13. Escape Sequences

14. Formatted String Output

15. Hexadecimal and Octal Input and Output

16. Binary Input and Output

17. File Inclusion

18. Variable-Length Argument Lists

19. Command-Line Arguments

20. Error Handling

21. Dynamic Memory Allocation

22. Pointer Arithmetic

23. Structure Declarations and Initialization

24. Union Declarations and Initialization

25. Bitwise Operators

26. Shift Operators

27. Conditional Statements

28. Switch Statements

29. Loops

30. While Loops

31. Do-While Loops

32. Break and Continue Statements

33. Arrays

34. Pointers

35. Functions

36. Recursion

37. Macros

38. Inline Functions

39. Typedef

40. Structs

41. Unions

42. Enums

43. Bit Fields

44. Variable-Length Arrays

45. Function Pointers

46. Dynamic Arrays

47. Linked Lists

48. Stacks

49. Queues

50. Binary Search Trees