NaaLaa

Full Version: Windows Program Console
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
What's up guys! Can we have examples of practical use of codes for the Windows console?

1 - Search.
2 - create directory.
3 - A program to receive two numbers from the user and make the sum and display it on the screen.
4 - Remove directories.
5 - Search within files, .txt, Doc.
6 - Basic Mini Compiler.
7 - Receive arguments via the prompt command line.

Something to learn more about the language.
thanks Smile
Hello!

Below is the first example. Console program name: add.n7a

Code:
' Programa para somar dois números recebidos do usuário
' Program to add two numbers received from the user

' Função principal
function main()
    ' Variáveis para armazenar os números e o resultado
    ' Variables to store the numbers and the result
    num1 = 0
    num2 = 0
    resultado = 0

    ' Solicitar o primeiro número
    ' Prompt for the first number
    pln("Enter the first number:")
    num1 = rln() ' Ler o primeiro número do console
                 ' Read the first number from the console
  
    ' Solicitar o segundo número
    ' Prompt for the second number
    pln("Enter the second number:")
    num2 = rln() ' Ler o segundo número do console
                 ' Read the second number from the console
 
    ' Realizar a soma
    ' Perform the sum
    resultado = int(num1) + int(num2)

    ' Exibir o resultado
    ' Display the result
    pln("The result of the sum is: " + resultado)
endfunc

' Chamar a função principal
' Call the main function
main()
I'll see if I can write some examples for the undocumented file library (file.n7). It contains functions for listing files etc. You can also use the 'system' command/function directly to execute any command line command.

I believe someone wrote an interpreter for tiny basic in n7, should be somewhere around here Smile