Introduction to Programming and Computing
|Objectives |
In this lab you are going to learn:
1. History of computing and computers. 2. Components of a computer system. 3. Hardware components. 4. Software systems. 5. Programming languages 6. DOS basic commands. 7. Use of CodeBlocks
|Overview | |
This section reviews some basic important functions needed for this course under MSDOS (Microsoft Disk Operating System) and learn how to write C++ programs. Creating source codes and compiling them will be the most frequent activity that you will do. You will learn about how to use CodeBlocks to create source codes and compile them and execute the output.
|Lab Exercises |(1 hour 45 minutes) |
DOS Exercise
Try the following practical exercises to gain familiarity with the MS-DOS commands.
A. Display contents of a directory
The following activities will demonstrate how you can view the contents of your folder/directory in DOS. Windows uses a new term called folders whereas the original DOS uses the term Directory. Both terms will be interchangeably use but will have the same meaning in this course. Try the following exercises in the Windows Command Prompt.
a. Try out this command and make a mental note of what you see.
dir/w
b. Similarly try out this command and see if there is any difference to output.
dir/p
B. Creating Directories
In DOS, you are allowed to create directories to store your files. Directories are provided to allow you to group similar files together for easy search and reference.
Creating a directory
To create a directory, issue the following command: mkdir .
For example the command: mkdir TCP1231 will create a directory called TCP1231.
Creating a sub-directory
To create a sub-directory you first have to navigate to the directory that you have created and then issue the same command (mkdir) with a new directory name. For example if you are already in the root (c:\ or d:\) and you wish to navigate to the newly created directory TCP1231, issue the following command:
cd TCP1231
The command cd indicates to DOS that you would like to change directory to TCP1231.
If you are in the directory TCP1231, you should be able to see the following prompt, D:\TCP1231>. At this prompt, issue the following command:
mkdir notes
This will create a subdirectory within the directory TCP1231 that is called notes. Confirm the successful creation of this directory by issuing the dir command. DOS uses a tree structure to main its directory.
Navigating the directory
To return to the top directory, simply issue the command: cd ..
(cd with two full stops).
If you are deep in a subdirectory and wishes to quickly return to the root directory, simple issue the following command: cd \
Copying Files
One of the functions that is allowed in all operating systems is the ability to copy files. Moving files is considered a basic function that is provided by DOS. There are two ways to copy files. One is to specify the absolute path of the source file and the destination of the files to be copied. Another way is to use the relative path method.
Copying a single file
The following command enables files to be copied.
Copy
copy C:\student\abu\lab1\myfirstprogram.cpp D:\Lab1\ myfirstprogram.cpp
Copying multiple files from hard disk to diskette
Instead of specifying the exact filenames you may use wildcards * to copy multiple files. copy C:\student\abu\lab1\*.cpp D:\Lab1\
Renaming files
Files that are stored in your diskette can be rename to anything you desire. But take note that these files might already have associated applications with them so be wise in renaming files.
a. Renaming files by copying
You may rename files by using the copy command by specifying a different destination file name in the copy command.
copy C:\student\abu\lab1\myfirstprogram.cpp D:\Lab1\ myprogram.cpp
b. Using the Rename Command
Another way to rename files is by using the rename command. For example if you wish to rename a file called apple.txt to pear.txt simply type the following command :
rename apple.txt pear.txt
c. Directory names can also be renamed by using the command rename in similar fashion.
Code::Blocks
We will be using Code::Blocks in our lab. You are required to download and install Code::Blocks in your personal machine. You may use other editors (Notepad++, Visual Studio, JGrasp, etc) for your revisions and assignments.
Download site: http://www.codeblocks.org/downloads/26
Files to download: codeblocks-10.05-setup.exe, codeblocks-10.05mingw-setup.exe
The lab machines are already equipped with the files and setup. Now……. Run a simple program, HelloWorld.cpp, in Code::Blocks.
1. Create a folder on your desktop and label it as “Lab01”
2. Go to C:\Program Files\CodeBlocks and double click on the codeblocks.exe to open the Code::Blocks editor.
3. Go to File in the main menu of the Code::Blocks editor and click on the New File or Empty File.
4. Click on the File-Save and name the file as HelloWorld.cpp and save it in the “Lab01” folder.
5. Copy the following into the code into HelloWorld.cpp file.
#include using namespace std; int main() { cout
You May Also Find These Documents Helpful
-
RATIONALE: The following calculations show that answer b is correct. The others are all wrong.…
- 5414 Words
- 22 Pages
Satisfactory Essays -
f. (make sure to do these in OSI order and this is not in order yet)…
- 1636 Words
- 7 Pages
Satisfactory Essays -
FOSS (Free and Open Source Software) had some trouble in 2006 when Microsoft submitted 235 patents that were allegedly violated by FOSS. Microsoft created these patents in order to collect royalties from companies in the “free world” (companies/people using free software). Eben Moglen of the Free Software Foundation contended that software is a mathematical algorithm and is not patentable. Moglen wrote, “It’s a tinderbox. As the commercial confrontation between free software and software-that’s-a-product becomes more fierce, patent law’s going to be the terrain on which a big piece of the war’s going to be fought.” FOSS has powerful corporate patrons and allies. So if Microsoft ever tried to sue Linux distributor Red Hat for patent infringement, for instance, OIN might sue Microsoft in retaliation, trying to enjoin distribution of Windows.…
- 705 Words
- 3 Pages
Good Essays -
c. Click on the computer monitor to view your results and transcribe them to Table 1 below.…
- 2517 Words
- 11 Pages
Powerful Essays -
1. Flash cards: It is similar to the traditional note cards but in electronic bases. It helps students to recall the terms and definitions of the textbook.…
- 695 Words
- 3 Pages
Good Essays -
b. So… all in all I’m really not sure what the exact answer is. Sorry bro…
- 1893 Words
- 8 Pages
Good Essays -
____ data items may involve organizing or sorting them, checking them for accuracy, or performing calculations with them.…
- 2450 Words
- 10 Pages
Satisfactory Essays -
Course Design Guide IT/210 Version 5 2 Week One: Introduction to Software Development Details Due Points Objectives 1.1 Describe the importance of using a structured, modular approach when creating program requirements, design, and code. 1.2 Identify how a computer processes and stores data. Course Preparation Read the course description and objectives.…
- 2571 Words
- 11 Pages
Satisfactory Essays -
| Allows users to organize data in rows and columns and perform calculations and recalculate when data changes.…
- 609 Words
- 3 Pages
Good Essays -
1. What is the ability of the world's populace to volunteer and collaborate on large projects called?…
- 1964 Words
- 8 Pages
Powerful Essays -
In general terms, a program that is broken into smaller units of code, such as methods, is known as a(n) _______.…
- 386 Words
- 5 Pages
Satisfactory Essays -
Write a program that would calculate and display the results for the multiplication table for values ranging from 1 to 100.…
- 366 Words
- 2 Pages
Good Essays -
A smart phone is definitely a mini computer that will do the same as a larger computer, as well as work as a phone and a camera. The smart phone processes information through aps to help a user to work, or just to be entertained, as well as surf the internet.…
- 1161 Words
- 5 Pages
Powerful Essays -
If you are new to programming with Python and are looking for a solid introduction, this is the book for you.…
- 108046 Words
- 492 Pages
Good Essays -
• Codes similar to everyday English • Use mathematical notations (translated via compilers) • Example:…
- 1751 Words
- 8 Pages
Good Essays