Вот пример того, как можно создать многострочный блокнот на разных языках программирования:
-
Python:
text = "" # Initialize an empty string while True: line = input("Enter a line (or 'exit' to quit): ") if line.lower() == "exit": break text += line + "\n" # Add the line to the text with a newline character print("Final text:") print(text) -
JavaScript:
let text = ""; // Initialize an empty string while (true) { let line = prompt("Enter a line (or 'exit' to quit): "); if (line.toLowerCase() === "exit") { break; } text += line + "\n"; // Add the line to the text with a newline character } console.log("Final text:"); console.log(text); -
Java:
import java.util.Scanner; public class Notepad { public static void main(String[] args) { StringBuilder text = new StringBuilder(); // Initialize an empty StringBuilder Scanner scanner = new Scanner(System.in); while (true) { System.out.print("Enter a line (or 'exit' to quit): "); String line = scanner.nextLine(); if (line.equalsIgnoreCase("exit")) { break; } text.append(line).append("\n"); // Add the line to the text with a newline character } System.out.println("Final text:"); System.out.println(text.toString()); } }
Это всего лишь несколько примеров того, как можно создать многострочный блокнот на разных языках программирования. Вы можете адаптировать эти примеры или изучить другие языки программирования, чтобы реализовать эту функциональность.