Executing a C program:
1. Open the C-IDE (Integrated Development Environment) by
double click on “short cut to tc” which is on desktop.
2. To create a new file select File (Alt+F), New (N) [F is
the hot key to File option and N is the hot key to New].
3. Type the program.
4. Save the program by selecting File (Alt+F), Save (S). or
select F2 (It is the short-cut to save option)
Here the name of C program is saved with .c extension. (C
automatically takes .c extension if we don’t give)
5. Executing the program.
|
6. Viewing the output.
- Output
of second execution
Some modifications:
The output of first execution is remaining there, even after
the completion of second execution. It may be confusing output while
experimenting with the program. We can use “clrscr();” to clear the output
generated by previous execution.
“getch();“ can be used to immediately display the output
instead of using Alt+F5 to view the output.
In turboc2, writing
#include<stdio.h> at the beginning of the program is not mandatory
to use printf(), scanf(), clrscr(), getch(). Because these are the default
functions of turboc2 compiler.
Modifying the structure of C program (Turboc2 only):
Comparison among the BASIC and C programming:
Specification:
Take two numbers and print the sum of them
Programs:
|
|||
|
|||
Specification:
Take the length, breadth of rectangle and print the area,
perimeter.
Programs:
|
||||
|
||||
Specification:
Take the price, quantity of a product and print the bill.
Program:
|
||||
|
||||
0 comments:
Post a Comment