Input/output and validation - Data types, structures and operators - Edexcel - GCSE Computer Science Revision - Edexcel - BBC Bitesize (2024)

Input/output and validation

A typical program inputs , processes it, then outputs it. The data input must be to ensure that the rest of the program functions properly.

Many programs take input from a user and then validate it before it is processed. It is important that the messages to the user are appropriate to reduce the risk of invalid data being entered. Messages should also be polite to encourage people to use the program!

The following section of Visual Basic.NET code asks the user to enter a number in a particular range, checks that it is the required range, and outputs an appropriate message to the user:

Console.WriteLine("Please enter a number between 1 and 10") num1 = Int(Console.ReadLine()) If num1 < 1 Or num1 > 10 Then Console.WriteLine("Sorry, this number is not between 1 and 10, try again") Else Console.WriteLine("Thanks for entering a valid number") End If
Input/output and validation - Data types, structures and operators - Edexcel - GCSE Computer Science Revision - Edexcel - BBC Bitesize (2024)
Top Articles
Latest Posts
Article information

Author: Cheryll Lueilwitz

Last Updated:

Views: 5509

Rating: 4.3 / 5 (74 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Cheryll Lueilwitz

Birthday: 1997-12-23

Address: 4653 O'Kon Hill, Lake Juanstad, AR 65469

Phone: +494124489301

Job: Marketing Representative

Hobby: Reading, Ice skating, Foraging, BASE jumping, Hiking, Skateboarding, Kayaking

Introduction: My name is Cheryll Lueilwitz, I am a sparkling, clean, super, lucky, joyous, outstanding, lucky person who loves writing and wants to share my knowledge and understanding with you.