Download Lab 01 Instructions for Using Turbo C in Computer Fundamentals and more Exercises Computer Fundamentals in PDF only on Docsity! Computer Fundamental Lab-01 Instructions 1. Use Borland C\C++ for the following programs 2. Create a folder CF_Labs 3. Create new folder for each lab e.g. create folder “lab‐01” and save all the files in that folder for this lab 4. Create new file for each of the following program 5. For any help contact lab staff or faculty member available in the lab 6. While leaving the lab close all programs and shutdown the computers, take a back up of your code 7. Do not discard this handout Reading for the LAB Programming Tool For programming in C we need 1) An editor to create files to write code 2)A Compiler that will check our C code and will translate the code to machine code 3) A program that will indicate errors in our program 4) A program that will let us check the output of our program , in this lab we are using Turbo C IDE, IDE stands for Integrated Development Environment, it is a program that provides us all the tools necessary for developing code in C Where to find Turbo C Turbo C is installed on all the systems in the lab, it is placed c:\TC (check your system for TC), if you want to use it on your own system, you can check \\172.30.10.8\software\Programming Languages or can download from internet Can we use a different IDE There are many IDEs available for programming in C/C++, e.g. Microsoft Visual C, Code::Block, Borland C, C Builder etc. Copy Test.C from the lab folder i.e. \\172.30.10.8\learningmaterial\Nauman Shamim\CF_2011\lab-01 and paste it to c:\TC\BIN folder Open TC In windows Click Start button, select RUN, type cmd, this will open a black window on your PC, type cd\ this will take you to C:\ now type cd tc it will change the director to tc you should see something like c:\tc now type cd bin, and now you should see c:\tc\bin type tc to execute turbo c OR Click my computer, go to C:\TC\BIN , there you should find a file TC.exe , double click it to execute it Now you should be in TC IDE , open test.c from file menu, after the file is opened press crt+f9 , if you see a success message your TC software is working fine, if there is no output or program don’t executes there is some problem, inform me is such case. TASK‐01 TEST TURBO C SOFTWARE Docsity.com Create a New File in TC by clicking File New, save the file as hello.c by clicking save from File menu or press F2 Write the following code in hello.c , and press F2 (to save the changes ) #include <stdio.h> void main(void) { printf(“Hello World “); } Compile the code by pressing F9 The compilation results will tell you the number of lines compiled, warnings and errors, there should be zero errors for successful compilation, in case of error you should contact me. Execute the code by pressing CRT+F9 Output For this program there output will not be displayed (will explain in lab), add the following line at the top in hello.c #include <conio.h> Add the following line in the last (just before closing bracket } ) getch(); Compile and execute your program and you should see “Hello World” in console. clrscr() It is a library function that clears the screen, when this function is executed any thing printed on the screen before this function will be cleared from the screen, for our program we will call this function in the beginning of our code in main so that the screen is cleaned before our printf prints anything on the screen #include <conio.h> #include <stdio.h> void main(void) { clrscr(); printf(“Hello World “); getch(); } TASK‐02 WRITE YOUR FIRST PROGRAM COMPILE AND EXECUTE IT TASK‐03 CLEAR OUTPUT SCREEN BEFORE PROGRAM OUTPUT Docsity.com