This input is output

xiaoxiao2021-03-06  72

To use the basic input and output, we have to start with the IMPORTS System to import system namespace at the beginning of the source code. The input output under the console is managed by the System.Console class. Basic input is console.readline, and the output is console.writeline. Below is an example: Imports System Public Module Mainmodule Public Sub Main Dim Str AS String Str = Console.Readline 'Read User Enter the One-line console.writeline (STR)' to read the content output console.readline End Subend Module below A slightly complex example (only the main function in later example): public Sub Main Dim Str As string console.writeline ("what is your name?") Str = console.readline console.writeline ("Hello," & Str & "!") Console.Readend Sub Next example gets two numbers from the user, add the result: Public Sub Main () DIM I, J AS Integer Console.writeline ("The first number:") i = cint (console.readline) 'console.readline accepts a string, we use the CINT function console.writeline ("second number:")' to convert a string into an integer J = CINT (Console.Readline) Console .Writeline ("The result is:" & i j) Console.Readend Sub acts as a console program, we should accept the parameters when running the program. Like Java, this parameter is the parameter of the main function in the code. Here is a simple example. Public Sub Main (Byval Args () AS String Dim Str As String Console.writeline ("Length of Args IS" & Args.length) Console.Readend Sub is a slightly complex example, listing the parameters entered by the user: Public Sub Main (Byval Args () AS String Dim Str As String () Dim I as Integer Console.writeline ("Length of Args IS" & Args.Length) for i = 0 to args.length - 1 console.writeline "ARGS (" & I & I & I)): "& Args (i)) Next Console.Readend Sub Input Output There is also a formatted way.

转载请注明原文地址:https://www.9cbs.com/read-93451.html

New Post(0)