Wednesday, September 15, 2010

04. WRITE A C PROGRAM STEP-2

Now we want to print some thing by a C program:
/* print you name */ /* Title */

#include<stdio.h>   /* Library file access */
#include<conio.h>
void main()          /*Function heading */
{
clrscr( );
printf("Enter your name !");
getch( );
}



In this programm i use [clrscr();] for to clear the output screen. suppose you run a program then alter it and run it again you may find that the previous output is still stacked there itself, at this time clrscr(); would clean the previous screen. If you use clrscr in your function you mast write a library function [#include<conio.h>]. This library function also use if you use getch  in your program. [ getch(); ] is used to hold the screen in simple language, if u don't write this the screen. Another thing i used in this program that is printf . If you want to print some thing in your program you mast yous this function name printf [printf();]. If you use this in your program you also need to write a library function called strio.h [#include<stdio.h>].

No comments:

Post a Comment