Laboratory Activity No. 1

9
Laboratory Activity No. 2 Notes: 1. Make sure you have created a folder in your D drive. (folder name: ME2) 2. Save your programs as prg1.c prg2.c prg3.c and so on and so forth. 1. Open TC.exe from desktop. 2. This window will show up on your screen

description

Comprog

Transcript of Laboratory Activity No. 1

Page 1: Laboratory Activity No. 1

Laboratory Activity No. 2

Notes:

1. Make sure you have created a folder in your D drive. (folder name: ME2)2. Save your programs as prg1.c prg2.c prg3.c and so on and so forth.

1. Open TC.exe from desktop.

2. This window will show up on your screen

Page 2: Laboratory Activity No. 1

3. Type ALT F on your keyboard. What happens?

The sub menus from the file tab opens

4. What are the sub menus for the File menu?Load (F3), Pick (Alt-F3), New, Save (F2), Write to, Directory, Change dir, OS shell, Quit (Alt-X).

5. What keys do you think would you need to press to open the sub menus for Edit? Run? Compile? Project? Options? Debug? Break? Provide screenshots.

Alt+E

Alt+R

Page 3: Laboratory Activity No. 1

Alt+C

Alt+P

Alt+O

Page 4: Laboratory Activity No. 1

Alt+D

Alt+B

6. The blue part of your Turbo C Environment is divided into two: Edit and Message. The Edit Box is where you will type your programs and the Message Box is where you will find messages from Turbo C (e.g errors, warnings, etc.)

7. To create a new file, do the ff:a. ALT Fb. Arrow down to new

Page 5: Laboratory Activity No. 1

This creates a new file.

c. ALT Fd. Arrow down to write to

This saves your file on your specified path.

e. To check for the current file you are working with, check the upper right corner of your edit box

Page 6: Laboratory Activity No. 1

f. Press ALT E and type the following:

#include <stdio.h>main(){ printf(“Hello World \n”); getch();}

8. Once done typing, save your file. To save your file, press F2.9. To run your program, press CTRL F9. Provide a screenshot of your program below.

Page 7: Laboratory Activity No. 1

10. Press enter to go back to your edit window11. Run your program again. What happens? Provide a screenshot below.

12. To clear the screen, add clrscr() to your code. What happens?

The second “Hello World” got deleted from the blue screen.

Meaning of each line of code:

#include <stdio.h> this is your preprocessor directive. C must include various libraries to support their codes. always start your codes with this line.

Page 8: Laboratory Activity No. 1

main() this is the start of the default function for your program. always include this on your codes.

{ this serves as the opening of your program

printf(“Hello World \n”); this prints the word Hello World on the screen. \n means new line or enter.

getch(); this prevents the screen from closing abruptly

} end of program

Write a C program that will produce the following output. Replace with your details. Save it on your folder in d drive. Provide screenshots of your code and your output.

Page 9: Laboratory Activity No. 1