https://flavorsrecipes.blogspot.com/?m=1 be more attractive: How to Make a Program Using Notepad

dimanche 1 août 2021

How to Make a Program Using Notepad

Notepad is a text editor that comes pre-installed on Windows computers. Notepad isn't just for taking notes and opening readme files. You can also use Notepad to make basic computer programs. You can do this by creating batch files that run scripts in the Windows Command Prompt. You can also write lines of code inside Notepad. This wikiHow teaches you how to make programs using Notepad.

[Edit]Steps

[Edit]Observing Some General Tips

  1. Open Notepad. Notepad has an icon that resembles a blue Notepad. You can use the following steps to open Notepad in the Windows Start menu:
    911936 1 2.jpg
    • Click the Windows Start button.
    • Type Notepad.
    • Click the Notepad icon.
  2. Determine your programming language. You can use any programming language in Notepad. However, it needs to be consistent throughout the entire program. You can also use batch script to create batch files that are executed in the Windows Command Prompt.
    911936 2 2.jpg
  3. Press after you complete each line of code. When writing code, you should always place each line of code on a separate line. This makes your code easier to read and easier to organize.
    911936 3 2.jpg
  4. Use indentation. It is common practice in coding to indent lines of code that are part of the same block of code. Sometimes you may even have blocks of code within blocks of code. In this case, you may need to double or triple indent your lines of code. If a line of code has an open bracket, brace, or parenthesis, all lines of code after that should be indented until the there is a closing bracket, brace, or parenthesis.
    911936 4 2.jpg
  5. Don't be afraid to comment out. Most programming languages have a way for you to comment out. This renders a block of text inert so that it isn't compiled or interpreted. This allows you to add comments to your code. For example, you can add a comment next to a line of code that briefly explains what the line of code does.
    911936 5 2.jpg
  6. Make sure the syntax is correct. Notepad doesn't have the ability to check or debug your code for you. You need to make sure the code you are entering is correct on your own. Do lots of proofreading. Make sure all your commands are spelled correctly and have the proper capitalization. Make sure you are using the correct opening and closing brackets or parenthesis for your coding language (e.g., { or [). Make sure all open lines of code have been closed. Make sure any special characters are being used correctly.
    911936 6 2.jpg
  7. Be sure to save the program with the correct file extension. By default, Notepad saves files as a text (.txt) file. This will not allow you to compile or run your program. When you save your program, you need to add the correct file extension for your programming language at the end of the file name. The following are a few file extensions that are used by common programming langauges:
    911936 7 2.jpg
    • Batch (BAT): -
    • HTML: -
    • CSS: -
    • Java: -
    • Python -
    • Ruby: .
    • C: -
    • C++ -
    • C#: -
  8. Save your file the correct way. When you are ready to save your file, use the following steps to add the correct file extension to your program and save it the correct way:
    911936 8 2.jpg
    • Click File.
    • Click Save as.
    • Use the drop-down menu next to "Save as type:" to select All Files(*.*).
    • Type a name for the program or file next to "File name."
    • Add the correct file extension at the end fo the file name (including the period).
    • Click Save.

[Edit]Creating a Basic BAT Program

  1. Open Notepad. You can use batch scripts to create a basic text-based program in the Command Prompt.
    911936 9 2.jpg
  2. Enter your batch script commands. Batch script can be used to run basic programs and scripts for Windows in the Command Prompt. The following are a few basic batch commands:[1]
    911936 10 2.jpg
    • @echo off - This removes all unnessessary text that can interfere with your program. This should always be the first command you enter.
    • echo - This command displays whatever text is written after it in the Command Prompt (i.g. "echo Hello World" would display "Hello World" as a line of text in the Command Prompt.).
    • echo. - The "echo." command (with a period at the end) displays a blank line in the Command Prompt. This is useful to isolate lines of text and make them not look cluttered.
    • pause - This command displays the prompt "Press any key to continue..." in the Command Prompt. This is used to create a break in your program. You can use this to allow the user time to read text in your program.
    • cls - This command stands for "clear screen." It clears all text from the screen.
    • title - This command displays whatever text that follows in the title bar of the Command Prompt.
    • color - This command allows you to change the color of the text in the Command Prompt by entering a corresponding letter or number after the command. You can see which letters and numbers corrispond to each color by typing "color/?" in the Command Prompt.
    • exit - This command exits the program.
  3. Make a complete script. There's a lot you can do with batch scripts alone. You can make a calculator, make a program that locks and hides folders on your computer. You can even make a game. The following is an example of a script that creates a basic guessing game:[2]
    911936 11 2.jpg
  4. Save the file as a batch file. Use the following steps to save the script as a batch file:
    911936 12 2.jpg
    • Click File.
    • Click Save as.
    • Use the drop-down menu next to "Save as type:" to select All Files(*.*).
    • Type a name for the program or file next to "File name."
    • Type ".bat" after the file name.
    • Click Save.
  5. Run the batch file. After you save your batch file, simply navigate to the location you saved it to and double-click it to open the Command Prompt and run your batch script.
    911936 13 2.jpg


[Edit]Creating a Basic HTML Program

  1. Open Notepad. HTML is primarily used for web design. It's a really simple language to learn and a good place to start if you are new to programming.
    911936 14 2.jpg
  2. Type and press . This line indicates to your web browser that this is an HTML document.
    911936 15 2.jpg
  3. Type and press . This is the opening tag for your entire HTML code. There will need to be a closing tag at the end of the document. All your HTML code will go in between these two tags.
    911936 16 2.jpg
  4. Type and press . This is the opening tag for the body of your HTML document. The body contains all the visual details of the document. This includes text, images, links, and embeded media.
    911936 17 2.jpg
  5. Type and press . This is the opening and closing tag for the text header of your document. This displays text in big, bold letters. Replace "Text" with whatever you want your header text to display.
    911936 18 2.jpg
    • For example: to create a page with the heading "Hello!", you would type "<h1>Hello!</h1>" into Notepad.
  6. Type and press . This is the opening and closing tag for your paragraph text. This displays text in regular small print. Replace "Text" with whatever you want your paragraph text to be.
    911936 19 2.jpg
    • For example, you would type <p>How are you today?</p> into Notepad to display the phrase "How are you today?" below the heading.
  7. Type and press . This is the closing body tag. This ends the body section of your HTML document.
    911936 20 2.jpg
  8. Type into Notepad. This is the closing tag of your HTML document. This closes out the entire document. This is usually the last line of code in an HTML document.
    911936 21 2.jpg
    • HTML is one of the easiest programming languages to learn. If you want to learn more about HTML, it is recommended you do some further reading onlne.
  9. Review your program's code. It should look something like this:
    911936 22 2.jpg
  10. Save the file as an HTML file. Use the following steps to save the text as an HTML file:
    911936 23 2.jpg
    • Click File.
    • Click Save as.
    • Use the drop-down menu next to "Save as type:" to select All Files(*.*).
    • Type a name for the file or file next to "File name."
    • Type ".html" after the file name.
    • Click Save.
  11. Open the HTML file in a web browser. To see what you have created, navigate to where you saved your HTML file, right-click it and select Open with... Then select any web browser of your choice. This will open the HTML file in your web browser.
    911936 24 2.jpg

[Edit]Creating a Basic Python Program

  1. Install Python. In order to run Python files on your computer, you must first install Python. You can download Python from Python.org.
    911936 25 2.jpg
  2. Open Notepad. Using the "print" command in Python, you can display any text that you want to.
    911936 26 2.jpg
  3. Type into Notepad. Make sure that there aren't any spaces when you type the opening command.
    911936 27 2.jpg
  4. Type after the quotation mark. This is the text that will be displayed when the program runs.
    911936 28 2.jpg
    • If you want, you can replace "Hello World!" with any other text you want.
  5. Type at the end of your text. This program only requires one line of code. It should look something like the following:
    911936 29 2.jpg
  6. Save the file as an Python file. Use the following steps to save the program as a Python file:
    911936 30 2.jpg
    • Click File.
    • Click Save as.
    • Use the drop-down menu next to "Save as type:" to select All Files(*.*).
    • Type a name for the program or file next to "File name."
    • Type ".py" after the file name.
    • Click Save.
  7. Open the Command Prompt. Use the following steps to open the Command Prompt in Windows:
    911936 31 2.jpg
    • Click the Windows Start icon.
    • Type CMD
    • Click the Command Prompt icon.
  8. Change to the file location of the Python file in the Command Prompt. You will need to know the exact location you saved the Python file to. Use the following steps to navigate to the folder the Python file is saved to in the Command Prompt:
    911936 32 2.jpg
    • Navigate to the Python file in File Explorer.
    • Right-click the folder name in the address bar at the top.
    • Click Copy Address.
    • Type cd in the Command Prompt (if it is located in a different drive location, such as a D: drive, you will need to type "D:" and press Enter to change to that drive location).
    • Press Ctrl + V to paste the folder address.
    • Press Enter
  9. Type the file name of the Python file and press . This runs the file in the Command Prompt. For example, if the file name is "hello.py", you would type "hello.py" and press Enter to execute it.
    911936 33 2.jpg

[Edit]Creating a Basic C++ Program

  1. Download and install a C++ compiler. While you can write a C++ file in Notepad, you cannot compile a C++ program. For that you will need a separate compiler. There are a variety of C++ compilers for Windows, including Cygwin, Visual Basic, and GCC. Download and install a compiler of your choice.
    911936 34 2.jpg
  2. Open Notepad. You'll be using Notepad to create a basic C++ program that displays "Hello World!" when run.
    911936 35 2.jpg
  3. Type in followed by your program's title. Typing two slash marks is how you comment out in C++. Any text typed after the two slash marks will not be compiled by the compiler. Type two slash marks followed by the name of your program at the top of the page.
    911936 36 2.jpg
  4. Type and press . This is the preprocessor command. This command instructs C++ to run the following lines of code as a program.
    911936 37 2.jpg
  5. Type and press . This declares the program's function.
    911936 38 2.jpg
  6. Type and press . This creates an open bracket. Your program's main code will go between this open bracket and a closed bracket.
    911936 39 2.jpg
  7. Type and press . This is the execution code of your program.
    911936 40 2.jpg
  8. Type } . This adds the closing bracket and closes the program's execution phase.
    911936 41 2.jpg
  9. Review your program. It should look something like this:
    911936 42 2.jpg
    • //Hello World
      #include <iostream>
      int main ()
      {
      std::cout << "Hello World!";
      }
      
  10. Save the file as an C++ file. Use the following steps to save the program as a C++ file:
    • Click File.
      911936 43 2.jpg
    • Click Save as.
    • Use the drop-down menu next to "Save as type:" to select All Files(*.*).
    • Type a name for the program or file next to "File name."
    • Type ".cpp" after the file name.
    • Click Save.
  11. Compile your program. The way you compile your program depends on which compiler you download. For some compilers, you will need to open the C++ file in the compiler itself. For some compilers, you may need to navigate to the ".cpp" file in the Command Prompt and type a specific command to compile the file. Once it is compiled, it will create an executable file (.exe) from the C++ file.
    911936 44 2.jpg
  12. Open the executable file. Once you compile the C++ file, double-click the executable file (.exe) to run the program.
    911936 45 2.jpg

[Edit]Tips

  • C++ and HTML are two of the most commonly used programming languages in existence.
  • You can use virtually any programming language to create most programs, though some languages are better-suited to specific functions (e.g., HTML is ideal for creating webpages).
  • If you are ready for some more advanced programming techniques, try making a game in Notepad
  • You can also install Notepad++ which contains more programming functions and allows for plugins that can compile programs inside the Notepad++

[Edit]Warnings

  • Always check your code before saving it. Saving a broken program can cause issues with your default program compiler.

[Edit]Related wikiHows

[Edit]References

[Edit]Quick Summary



source How to of the Day https://ift.tt/3jeuz3s

Aucun commentaire:

Enregistrer un commentaire

https://warriorplus.com/o2/a/x8g6yk/0

How to Celebrity Look Alike Quiz

Have you ever wondered who your celebrity look-alike is? Do people say you look like Taylor Swift and you’re desperate to know if they’re r...

https://warriorplus.com/o2/a/x8g6yk/0