< A Level Computer Science Programming Guide

Input And Output

Language General Usage Example Usage
Pseudocode
INPUT <Identifier>
Input Answer
Input Age
Input DistanceTravelled
VB.NET
<Identifier> = Console.Readline()

Dim <Identifier> As <Data Type> = Console.ReadLine()
Answer = Console.ReadLine()
Dim Age As Integer = Console.ReadLine()
DistanceTravelled = Console.ReadLine()

Arithmetic, Relational and Logic Operators

Language Arithmetic Operators Integer Division Relational Operators Logic Operators
Addition Subtraction Multiplication Division Modulus Division Greater Than Less Than Greater Than or Equal to Less Than or Equal to Equal To Not Equal To AND OR NOT
Pseudocode + - * / MOD DIV > < >= <= = <> AND OR NOT
VB.NET + - * / MOD \ > < >= <= = <> AND OR NOT

String Operators

Language General Usage Example Usage
Pseudocode
VB.NET

Random Number Generation

Language General Usage Example Usage
Pseudocode
RANDOMBETWEEN(<Minimum>, <Maximum>)
Generates a random INTEGER between the Minimum and Maximum.
RND()
Generates a random REAL number between 0 and 1.
DECLARE Random : INTEGER
Random = RANDOMBETWEEN(10, 17)

DECLARE Random : REAL
Random = RND()
VB.NET
<Variable> = <Minimum> + Rnd() * (<Maximum> - <Minimum>)
Generates a random INTEGER between the Minimum and Maximum.
Rnd()
Generates a random REAL number between 0 and 1.
Dim Random As Integer
Random = RANDOMBETWEEN(10, 17)
Random = 10 + Rnd() * (17 - 10)

Dim Random As Double
Random = Rnd()
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.