0% found this document useful (0 votes)
148 views5 pages

Introduction to QBasic Programming

This document introduces the reader to programming concepts using the QBasic language through 24 chapters of increasing complexity. It aims to increase understanding of computers for non-computer science students through hands-on practice writing simple programs. The introduction outlines the goal of teaching basic programming principles rather than making the reader a professional programmer. Later chapters discuss fundamental programming concepts like statements, arithmetic, and syntax that will be built upon in subsequent chapters through writing small example programs.

Uploaded by

George Laryea
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
148 views5 pages

Introduction to QBasic Programming

This document introduces the reader to programming concepts using the QBasic language through 24 chapters of increasing complexity. It aims to increase understanding of computers for non-computer science students through hands-on practice writing simple programs. The introduction outlines the goal of teaching basic programming principles rather than making the reader a professional programmer. Later chapters discuss fundamental programming concepts like statements, arithmetic, and syntax that will be built upon in subsequent chapters through writing small example programs.

Uploaded by

George Laryea
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PREFACE

These notes are an introduction to computer programming using the language QBasic. The twenty-four chapters will give you an idea of what programming is all about. If you faithfully work your way through all the chapters, you will learn how all the gritty details that programming involves add up to the wonderful things called "programs." You will be able to write some simple programs yourself. These notes are about programming, but they do not try to make you a programmer. Their goal is to increase your understanding of computers in the modern world. If you are thinking about becoming a programmer, studying these notes is a good first step. However, these notes are aimed at students who are not computer science majors. Details have been kept to a minimum.
Chapter Topics:
How

to use these notes. Why study QBasic?

Active Learning
Studying a technical subject such as programming can get awfully dull. To make it interesting, use what you have learned as soon as you learn it. One way to do this is to pause and think for a while after every few paragraphs. The questions encourage you to do just that. When you encounter a question, stop and think about it, even if it is an easy question. Most questions are about the material that has just been presented. Some of them have you complete part of a small program, or work out a small problem. By reading and answering the questions you will achieve two things:
You

will be engaged in active learning. o Active learning keeps your brain engaged. The material will be more interesting, and you will learn it better. You will be monitoring you own progress. o As you compare your answers to the suggested answers you will see how well you are doing.

Thousands and Thousands of Languages.


Many thousands of computer languages have been invented. There are several hundred languages still actively being used. This sounds like a terrible situation, but it is not, because of:
Two Facts about Computer Languages:

1. All computer programming languages are fundamentally the same. o All programmers have the same fundamental understanding of programming, regardless of what particular programming language they use. 2. Any program can be written with any programming language. o However, some languages are more effective for some types of programs. It is hard to explain why these two things are true without going into details. A (rather crude) analogy is that computer programming is like music:
Two Facts about Music:

1. All music is fundamentally the same: it consists of musical tones and rhythm. o All musicians have the same fundamental understanding of music, no matter what instrument they play. 2. Any song can be played on any instrument. o However, a lullaby is not effective when played upon drums. All programming languages contain the same fundamental features. You will see all of these features in this course. (There are surprisingly few fundamental features.) The difference between languages is mostly a matter of emphasis and convenience.

Basic BASIC
The language BASIC was designed in the early 1960s for teaching the basic principles of programming to non-science majors. It has been popular ever

since. There are many versions of BASIC. These notes use QBasic, a version that once came free with Microsoft operating systems. With QBasic you can easily write small programs and get the idea of what programming is about. Other versions of BASIC are intended for professional programmers who expect to write programs that are many thousands of lines long. Our programs will not get that long.

QBasic on your Computer


If your computer is running any variety of a Microsoft operating system, it can run QBasic. If your computer is running DOS or Windows 3.1 it already has QBasic. Microsoft Windows 95, Windows 98, and Windows NT operating systems may have QBasic if it was chosen when the operating system was installed. Microsoft Windows ME, Windows 2000, and Windows XP do not come with QBasic (but it can be installed on these systems. See below). To check if your computer has QBasic:

1. Find the Command Prompt on your computer.

If you are running DOS, this is the prompt that asks you for commands. o If you are running Windows 3.1, find the "DOS prompt icon." This is usually in the Main window. The icon is a little picture of the letters MSDOS. Double-click on the icon. o If you are running a more recent operating system, click on the "Start" button. Click on "Run" In the "Open" box, enter CMD Click "OK" (or hit "Enter") 2. When you get a window with the prompt, enter the command: qbasic then press the ENTER key.
o

3. QBasic should start up. The pictures in CHAPTER 1 show what you should see. If you can not find QBasic after doing the above, you might still have it on your system. Browse through your disk, use "search" from the start menu (look for [Link]), or maybe look at the documentation. To get a copy of QBasic from the web, go to: [Link] Details about downloading and installing QBasic are given in Appendix A. Additional information about QBasic (including suggestions for downloading) can be found at [Link] (These links worked as of September 25, 2004.) If you can't find QBasic, you can still read these notes. They won't be as interesting, but because of the active learning you will still be writing some small programs. If you are an Internet ace, you could try the microsoft web pages for a downloadable copy of QBasic.

CHAPTER 1 Small Programs


In this chapter you will learn to write small programs in the computer programming language called QBasic. These small programs won't do very much. But in following chapters you will write programs that do much more.
Chapter Goals
QBasic

statements. The PRINT statement. The END statement. Arithmetic operators. Strings. Sequential execution. Syntax errors. Bugs. The small programs in this chapter perform calculations similar to the arithmetic done with a electronic calculator. QBasic does much more than

that. But in this chapter, pretend that QBasic is a calculator that uses a keyboard for input. Instead of punching buttons on a calculator, you will write a program.

Common questions

Powered by AI

Active learning in programming differs from traditional study methods through its emphasis on engagement and application. Rather than passively consuming information, learners are encouraged to interact with the material by solving problems and completing programming tasks as they learn new concepts. This interactive approach helps learners solidify their understanding and retain information more effectively compared to traditional methods that might focus solely on memorization or passive reading. Active learning also involves self-assessment, allowing learners to monitor their progress and adjust their learning strategies .

The foundational features shared by all programming languages include elements like variables, control structures (such as loops and conditionals), data structures, syntax, and semantics. Understanding these features is crucial for learners because they form the basis of all programming. By mastering these fundamentals, learners can more easily transfer their skills from one language to another, adapting to new languages without needing to relearn these core concepts, thus bridging the gap between different languages effectively .

QBasic serves as an introductory programming language designed to teach the basic principles of programming to non-science majors. Its simplicity and ease of use allow learners to grasp programming concepts without dealing with the complexities found in professional-grade programming languages. QBasic's features reflect this role by providing a simple environment where users can write small, uncomplicated programs, thereby focusing more on understanding the logic of programming rather than intricate syntax or extensive program length .

BASIC, and by extension QBasic, was popular for teaching programming principles due to its simplicity and accessibility. BASIC was designed in the early 1960s specifically for teaching non-science majors the fundamentals of programming, making it straightforward and easy to use. QBasic, a simplified version of BASIC that came with Microsoft operating systems, continued this tradition by allowing users to easily write and run small programs, facilitating an understanding of basic programming concepts without the complexities found in more advanced languages .

The two facts about computer languages—that all computer languages are fundamentally the same and any program can be written with any programming language—parallel the facts about music in that all programming, regardless of the language, shares a fundamental understanding similar to how all music consists of musical tones and rhythm. Additionally, just as any song can be played on any instrument, any program can be written in any language, though some languages are better suited for specific types of programs, much like certain instruments are more suitable for specific musical styles .

To check for and run QBasic on a Windows operating system, first access the Command Prompt. In DOS, this is already present as the command prompt. In Windows 3.1, look for the 'DOS prompt icon' in the Main window. In more recent Windows versions, click 'Start', then 'Run', type 'CMD' in the 'Open' box, and click 'OK'. Once at the command prompt, type 'qbasic' and press ENTER to launch QBasic. If QBasic does not start, search for 'qbasic.exe' on the disk or consult documentation. Alternatively, a downloadable copy is available online .

Choosing a particular programming language is more effective in scenarios where certain features or conveniences of that language align better with the task at hand, similar to choosing the right musical instrument for a song. While any programming language can execute any task, some languages provide more efficient or simpler means for specific types of programs—such as data processing, web development, or system programming—reflecting a parallel to using appropriate instruments for musical styles (e.g., avoiding a lullaby on drums).

Active learning provides the benefit of keeping the learner's brain engaged, which makes studying programming concepts more interesting and effective. This engagement helps learners retain the material better. Additionally, by allowing learners to monitor their own progress through answering questions and comparing their answers with suggested ones, they gain insights into their understanding and progress, thereby reinforcing their learning and confidence in the material .

Yes, QBasic can be used in modern operating systems that do not include it by default. Users can download a copy of QBasic from websites like devedia.com or qbasic.com, as mentioned in the document. Appendix A of the documents provides detailed instructions on downloading and installing QBasic. Even without QBasic, users can still read through the learning material and engage in active learning by reviewing small programs as suggested in the chapters .

A student might face the challenge of not being able to practice writing and executing small programs in QBasic if their computer does not have it installed. This could hinder their active engagement and understanding of the programming concepts taught. The document suggests solutions like searching the computer for 'qbasic.exe', exploring documentation for installation options, downloading QBasic from recommended websites like devedia.com or microsoft web pages, and following Appendix A for installation instructions. These steps help overcome the accessibility issue, allowing students to continue their learning effectively .

You might also like