Thursday, 21 June 2012

write a c program to read the data from the text file and display the data on the screen. if the file is not exit create file


/*write a c program to read the data from the text file and
display the data on the screen. if the file is not exit create file*/
#include<stdio.h>
#include<conio.h>

void main()
{
FILE *fs;
char ch;
clrscr();
fs=fopen("d:\peer.txt","a+");
if(fs==NULL)
{
printf("source file cannot open");
exit();
}
while(1)
{
ch=getc(fs);
if(ch==EOF)
break;
else
printf("%c",ch);
}
fcloseall();
getch();
}
/*================================================================================
==============                                                                
list details of employee who belong to 'computer' department and salary > 20000.
                                                                               
================================================================================
==============                                                                
SQL> select e.empno,e.empname,e.salary,e.commision,e.designation,e.deptno from e
mployee e,depart d w                                                          
here e.deptno=d.deptno and d.deptname='computer' and e.salary>20000;          
                                                                               
     EMPNO EMPNAME                  SALARY  COMMISION DESIGNATION              D
EPTNO                                                                          
---------- -------------------- ---------- ---------- -------------------- -----
-----                                                                          
       202 santosh                   30000       1000 salermanager            
  102                                                                          
       206 asif                      45000       3000 board of director        
  106                                                                          


================================================================================
==============
QUAry 4
================================================================================
==============
display of all employee whose designation is 'manager' & salary is >25000
================================================================================
==============

SQL> select * from emp where designation='manager' and salary>25000;

     EMONO EMPNAME                  SALARY  COMMISION DESIGNATION              D
EPTNO
---------- -------------------- ---------- ---------- -------------------- -----
-----
       206 muneer                    26000        600 manager
  106



=====================================   END   ==================================
===============



Type EXIT to return to Turbo C++. . .Microsoft(R) Windows DOS
(C)Copyright Microsoft Corp 1990-2001.

C:\TC\BIN>exit */

No comments: