Monday, June 2, 2014

BSc.CSIT Program

Course of Study for B.Sc.CSIT Program
(Four Years/ Eight Semesters Academic Program)

[1]Freshman Year / First Semester
1. Introduction of Information Technology
2. Fundamentals of Computer Programming
3. Probability and Statistics
4. Calculus and Analytical Geometry
Natural Science Elective 1: A student can opt for any one of the following courses
                      a)     Physics I
                      b)    Biology I
                      c)     Geology I
                      d)    Statistics I

[2]Freshman Year / Second Semester:
1. Digital Logic
2. Discrete Structure
3. Microprocessor
4. Data Structures and Algorithms
5. Linear Algebra
Natural Science Elective 2: Students can Opt. for any of the following courses
                      a)     Physics I
                      b)    Biology I
                      c)     Geology I
                      d)    Statistics I

[3]Sophomore Year/ Third Semester:
1. Computer Architecture
2. Object Oriented Programming Language
3. Operating Systems
4. Numerical Methods
5. Introduction to Management

[4]Sophomore Year/ Forth Semester:
1. Theory of Computation
2. System Analysis and Design
3. Database Management System 1
4. Computer Graphics
5. Introduction of Cognitive Science
6. Technical Writing


[5]Junior Year/ Fifth Semester:
1. Computer Networks
2. Simulation and Modeling
3. Design and Analysis of Algorithms
4. Artificial Intelligence
Computer Science Elective 1: Students can Opt. for any of the following courses
                          a)     Microprocessor Based Design
                          b)     Applied Logic
                          c)      E-governance
                          d)    Wireless Networking
                          e)     International Business Management
                          f)      International Marketing
                          g)     Neutral Networks
                          h)    Computer Hardware Design      
                           i)     Cryptography

[6]Junior Year/ Sixth Semester:
1. Software Engineering
2. Compiler Design and Construction
3. Web Technologies
4. Real Time System
Computer Science Elective 2: Any one of the following courses
                             a)     Knowledge Management
                             b)    Fundamentals of E-commerce
                              c)     Society and Ethics in Information Technology
                              d)    Automation and Robotics
                              e)     Digital System Design
                               f)      Net Centric Computing
                               g)     Web Centric Computing    
                               h)    Embedded System Programming
                                i)       Image Processing
[7]Senior Year/ Seventh Semester:
A) Specialization Area: Networking
1. Introduction to System Administration
2. Network Security
3. Linux Networking
4. Managing a Microsoft Server Environment
5. Implementing, Managing and Maintaining Server Network and Infrastructure network Services.

B) Specialization Area: Database
1. Web Database and Information System
2. Advance Database and Information System
3. Distributed and Object Oriented Database

Database Elective 1: Students can Opt. for any one of the following courses
                    1. Introduction of Oracle and XML
                    2. Application Server Web Administration

Database Elective 2: Students can Opt. for any one of the following courses
                     1. Information Retrieval and Search Engine
                     2. Multimedia Database


[8]Senior Year/ Eighth Semester:
A) Specialization Area: Networking
1. Implementing and Supporting Windows OS/ Linux
2. Distributed Networking
3. Project on real Warehousing and Data Mining
4. Internship/Project

B) Specialization Area: Database
1. Decision Support and Expert System
2. Decision Warehousing and Data Mining
3. Project of Database System
4. Internship/ Project



Sunday, March 30, 2014

Lab Report of lab 11 for ASIAN COLLEGE OF HIGHER STUDIES BSc.CSIT 1st Semester Student



Lab No. 11
OBJECT
Structures
THEORY
If we want a group of same data type we use an array. If we want a group of elements ofdifferent data types we use structures. For Example: To store the names, prices and number ofpages of a book you can declare three variables. To store this information for more than onebook three separate arrays may be declared. Another option is to make a structure. No memory is allocated when a structure is declared. It simply defines the “form” of thestructure. When a variable is made then memory is allocated. This is equivalent to saying thatthere is no memory for “int” , but when we de clare an integer i.e.
is allocated.The structure for the above mentioned case will look like
struct books
{
char bookname[20];
float price;
int pages;
};
struct book[50];
the above structure can hold information of 50 books.

EXERCISE
Consider the following table.

Code

Name

Post

City

Tel

Salary
1
John
Clerk
Biratnagar
545332
7000
2
Marry
Programmer
Dharan
538901
20000
3
Dipesh
Director
Dhulabari
782112
30000
4
Abanish
Director
Pokhara
763452
30000
5
Reena
Assistance technician
Kathmandu
636721
15000
6
Manoj
Programmer
Kathmandu
450089
20000
7
Shiva
Main technician
Ithari
810012
20000
8
Bivek
System engineer
Dharan
511134
20000
9
Roshan
Programmer
Patan
889975
20000
10
Prakash
Accountant
Patan
440054
15000
The table consists of records of employees of an organization.









Section-A
(a)   Write a program in “C” to input records through keyboard and store them in a structure array called Employee.
Ans:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
  {
    struct employee
     {
      char name;
      char post;
      char city;
      int phone;
      float sallary;
     };
     clrscr();
  struct employee emp[10];
   int i;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      scanf("%s%s%s%f%d",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
   }
   linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
       return a;
    }

(b)   Write a function to display the list of all Records.
Ans:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
  {
    struct employee
     {
      char name;
      char post;
      char city;
      int phone;
      float sallary;
     };
     clrscr();
  struct employee emp[10];
   int i;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      scanf("%s%s%s%f%d",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
    printf("Name\tPost\tCity\tPhone.No\tSallary\n");
    for(i=0;i<10;i++)
    printf("\n%s\t%s\t%s\t%f\t%d\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
   }
   linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
       return a;
    }
Section-B
(a)   Display the records of those employees whose post is Programmer.
Ans:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void linkfloat();
    struct employee
     {
      char name[20];
      char post[20];
      char city[20];
      int phone;
      float sallary;
     };
 void main()
 {
  struct employee emp[10];
   int i;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      fflush(stdin);
      scanf("%s%s%s%d%f",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
    printf("Name\tPost\tCity\tPhone.No\tSallary\n");
    for(i=0;i<10;i++)
    {
    if(strcmp(emp[i].post,"programmer")==0)
      printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    }
    getch();
   }
  void linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
    }

(b)   Display the records of those employees whose post is System engineer.
Ans:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void linkfloat();
    struct employee
     {
      char name[20];
      char post[20];
      char city[20];
      int phone;
      float sallary;
     };
 void main()
 {
  struct employee emp[10];
   int i;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      fflush(stdin);
      scanf("%s%s%s%d%f",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
    printf("Name\tPost\tCity\tPhone.No\tSallary\n");
    for(i=0;i<10;i++)
    {
    if(strcmp(emp[i].post,"system engineer")==0)
      printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    }
    getch();
   }
  void linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
    }

(c)    Display the records of those employees whose post is Director.
Ans:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void linkfloat();
    struct employee
     {
      char name[20];
      char post[20];
      char city[20];
      int phone;
      float sallary;
     };
 void main()
 {
  struct employee emp[10];
   int i;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      fflush(stdin);
      scanf("%s%s%s%d%f",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
    printf("Name\tPost\tCity\tPhone.No\tSallary\n");
    for(i=0;i<10;i++)
    {
    if(strcmp(emp[i].post,"director")==0)
      printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    }
    getch();
   }
  void linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
    }

(d)   Display the records of those employees whose post is Clerk.
Ans:
#include<stdio.h>
#include<conio.h>
#include<string.h>f
void linkfloat();
    struct employee
     {
      char name[20];
      char post[20];
      char city[20];
      int phone;
      float sallary;
     };
 void main()
 {
  struct employee emp[10];
   int i;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      fflush(stdin);
      scanf("%s%s%s%d%f",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
    printf("Name\tPost\tCity\tPhone.No\tSallary\n");
    for(i=0;i<10;i++)
    {
    if(strcmp(emp[i].post,"clerk")==0)
      printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    }
    getch();
   }
  void linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
    }

(e)   Display the records of those employees whose salary scale is greater than 15000.
Ans:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void linkfloat();
    struct employee
     {
      char name[20];
      char post[20];
      char city[20];
      int phone;
      float sallary;
     };
 void main()
 {
  struct employee emp[10];
   int i;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      fflush(stdin);
      scanf("%s%s%s%d%f",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
    printf("Name\tPost\tCity\tPhone.No\tSallary\n");
    for(i=0;i<10;i++)
    {
    if(emp[i].sallary>15000)
      printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    }
    getch();
   }
  void linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
    }

(f)     Display the records of those employees who lives in Kathmandu.
Ans:
       #include<stdio.h>
#include<conio.h>
#include<string.h>
void linkfloat();
    struct employee
     {
      char name[20];
      char post[20];
      char city[20];
      int phone;
      float sallary;
     };
 void main()
 {
  struct employee emp[10];
   int i;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      fflush(stdin);
      scanf("%s%s%s%d%f",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
    printf("Name\tPost\tCity\tPhone.No\tSallary\n");
    for(i=0;i<10;i++)
    {
    if(strcmp(emp[i].city,"kathmandu")==0)
      printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    }
    getch();
   }
  void linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
    }

(g)   Display the records of those employees who lives in Dharan.
Ans:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void linkfloat();
    struct employee
     {
      char name[20];
      char post[20];
      char city[20];
      int phone;
      float sallary;
     };
 void main()
 {
  struct employee emp[10];
   int i;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      fflush(stdin);
      scanf("%s%s%s%d%f",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
    printf("Name\tPost\tCity\tPhone.No\tSallary\n");
    for(i=0;i<10;i++)
    {
    if(strcmp(emp[i].city,"dharan")==0)
      printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    }
    getch();
   }
  void linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
    }

(h)   Display the records of those employees who lives in Patan.
Ans:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void linkfloat();
    struct employee
     {
      char name[20];
      char post[20];
      char city[20];
      int phone;
      float sallary;
     };
 void main()
 {
  struct employee emp[10];
   int i;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      fflush(stdin);
      scanf("%s%s%s%d%f",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
    printf("Name\tPost\tCity\tPhone.No\tSallary\n");
    for(i=0;i<10;i++)
    {
    if(strcmp(emp[i].city,"patan")==0)
      printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    }
    getch();
   }
  void linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
    }

(i)     Display the records of those employees who are not Programmer.
Ans:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void linkfloat();
    struct employee
     {
      char name[20];
      char post[20];
      char city[20];
      int phone;
      float sallary;
     };
 void main()
 {
  struct employee emp[10];
   int i;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      fflush(stdin);
      scanf("%s%s%s%d%f",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
    printf("Name\tPost\tCity\tPhone.No\tSallary\n");
    for(i=0;i<10;i++)
    {
    if((strcmp(emp[i].post,"programmer")>0)||(strcmp(emp[i].post,"programmer")<0))
      printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    }
    getch();
   }
  void linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
    }

(j)     Display the records of those employees who are not Director.
Ans:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void linkfloat();
    struct employee
     {
      char name[20];
      char post[20];
      char city[20];
      int phone;
      float sallary;
     };
 void main()
 {
  struct employee emp[10];
   int i;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      fflush(stdin);
      scanf("%s%s%s%d%f",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
    printf("Name\tPost\tCity\tPhone.No\tSallary\n");
    for(i=0;i<10;i++)
    {
    if((strcmp(emp[i].post,"director")>0)||(strcmp(emp[i].post,"director")<0))
      printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    }
    getch();
   }
  void linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
    }

(k)   Display the records of those employees whose salary scale is lesser than 20000
Ans:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void linkfloat();
    struct employee
     {
      char name[20];
      char post[20];
      char city[20];
      int phone;
      float sallary;
     };
 void main()
 {
  struct employee emp[10];
   int i;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      fflush(stdin);
      scanf("%s%s%s%d%f",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
    printf("Name\tPost\tCity\tPhone.No\tSallary\n");
    for(i=0;i<10;i++)
    {
    if(emp[i].sallary<20000)
      printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    }
    getch();
   }
  void linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
    }

(l)     Sort the records with respect to City in ascending order and print them.
Ans:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void linkfloat();
    struct employee
     {
      char name[20];
      char post[20];
      char city[20];
      int phone;
      float sallary;
     };
 void main()
 {
  struct employee emp[10];
   int i,j;
   struct employee temp;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      fflush(stdin);
      scanf("%s%s%s%d%f",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
     printf("\nbefore sorting");
     printf("Name\tPost\tCity\tPhone.No\tSallary\n");
     printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    for(i=0;i<10;i++)
    {
      for(j=0;j<10;j++)
      {
        if(strcmp(emp[i].city,emp[j].city)<0)
        {
         temp=emp[i];
         emp[i]=emp[j];
         emp[j]=temp;
        }
    }
}
    printf("\nAfter soring Acording to city");
    for(i=0;i<10;i++)
    {
    printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    }
    getch();
   }

 void linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
    }

(m) List the post of employees who gets highest salary.
Ans:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void linkfloat();
    struct employee
     {
      char name;
      char post;
      char city;
      int phone;
      float sallary;
     };
 void main()
 {
  struct employee emp[10];
   int i,j,k;
   char temp;
   float h;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      fflush(stdin);
      scanf("%s%s%s%d%f",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
    printf("\nPost of higeher sallery\n");
    h=emp[0].sallary;
    for(i=0;i<10;i++)
    {
       if(h<=emp[i].sallary)
       {
           h=emp[i].sallary;
           k=i;
       }
    }
      printf("%s",emp[k].post);
    getch();
   }
  void linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
    }


(n)   List the post of employees who gets lowest salary.
Ans:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void linkfloat();
    struct employee
     {
      char name;
      char post;
      char city;
      int phone;
      float sallary;
     };
 void main()
 {
  struct employee emp[10];
   int i,j,k;
   char temp;
   float l;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      fflush(stdin);
      scanf("%s%s%s%d%f",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
    printf("\nPost of lower sallery\n");
    l=emp[0].sallary;
    for(i=0;i<10;i++)
    {
       if(l>=emp[i].sallary)
       {
           l=emp[i].sallary;
           k=i;
       }
    }
      printf("%s",emp[k].post);
    getch();
   }
  void linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
    }

Section-C
(a)   Sort the records with respect to Name in ascending order and print them.
Ans:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void linkfloat();
    struct employee
     {
      char name[20];
      char post[20];
      char city[20];
      int phone;
      float sallary;
     };
 void main()
 {
  struct employee emp[10];
   int i,j;
   struct employee temp;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      fflush(stdin);
      scanf("%s%s%s%d%f",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
     printf("\nbefore sorting");
     printf("Name\tPost\tCity\tPhone.No\tSallary\n");
     printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    for(i=0;i<10;i++)
    {
      for(j=0;j<10;j++)
      {
        if(strcmp(emp[i].name,emp[j].name)<0)
        {
         temp=emp[i];
         emp[i]=emp[j];
         emp[j]=temp;
        }
    }
}
    printf("\nAfter soring Acording to name");
    for(i=0;i<10;i++)
    {
    printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    }
    getch();
   }

 void linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
    }

(b)   Sort the records with respect to Name in descending order and print them.
Ans:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void linkfloat();
    struct employee
     {
      char name[20];
      char post[20];
      char city[20];
      int phone;
      float sallary;
     };
 void main()
 {
  struct employee emp[10];
   int i,j;
   struct employee temp;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      fflush(stdin);
      scanf("%s%s%s%d%f",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
     printf("\nbefore sorting");
     printf("Name\tPost\tCity\tPhone.No\tSallary\n");
     printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    for(i=0;i<10;i++)
    {
      for(j=0;j<10;j++)
      {
        if(strcmp(emp[i].name,emp[j].name)>0)
        {
         temp=emp[i];
         emp[i]=emp[j];
         emp[j]=temp;
        }
    }
}
    printf("\nAfter soring Acording to name");
    for(i=0;i<10;i++)
    {
    printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    }
    getch();
   }

 void linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
    }
(c)    Sort the records with respect to Salary in ascending order and print them.
Ans:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void linkfloat();
    struct employee
     {
      char name[20];
      char post[20];
      char city[20];
      int phone;
      float sallary;
     };
 void main()
 {
  struct employee emp[10];
   int i,j;
   struct employee temp;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      fflush(stdin);
      scanf("%s%s%s%d%f",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
     printf("\nbefore sorting");
     printf("Name\tPost\tCity\tPhone.No\tSallary\n");
     printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    for(i=0;i<10;i++)
    {
      for(j=0;j<10;j++)
      {
        if(emp[i].sallary>emp[j].sallary)
        {
         temp=emp[i];
         emp[i]=emp[j];
         emp[j]=temp;
        }
    }
}
    printf("\nAfter soring Acording to sallary");
    for(i=0;i<10;i++)
    printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    getch();
   }

 void linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
    }
(d)   Sort the records with respect to Salary in descending order and print them.
Ans:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void linkfloat();
    struct employee
     {
      char name[20];
      char post[20];
      char city[20];
      int phone;
      float sallary;
     };
 void main()
 {
  struct employee emp[10];
   int i,j;
   struct employee temp;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      fflush(stdin);
      scanf("%s%s%s%d%f",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
     printf("\nbefore sorting");
     printf("Name\tPost\tCity\tPhone.No\tSallary\n");
     printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    for(i=0;i<10;i++)
    {
      for(j=0;j<10;j++)
      {
        if(emp[i].sallary<emp[j].sallary)
        {
         temp=emp[i];
         emp[i]=emp[j];
         emp[j]=temp;
        }
    }
}
    printf("\nAfter soring Acording to sallary");
    for(i=0;i<10;i++)
    {
    printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    }
    getch();
   }

 void linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
    }
(e)   Sort the records with respect to City in ascending order and print them.
Ans:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void linkfloat();
    struct employee
     {
      char name[20];
      char post[20];
      char city[20];
      int phone;
      float sallary;
     };
 void main()
 {
  struct employee emp[10];
   int i,j;
   struct employee temp;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      fflush(stdin);
      scanf("%s%s%s%d%f",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
     printf("\nbefore sorting");
     printf("Name\tPost\tCity\tPhone.No\tSallary\n");
     printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    for(i=0;i<10;i++)
    {
      for(j=0;j<10;j++)
      {
        if(strcmp(emp[i].city,emp[j].city)<0)
        {
         temp=emp[i];
         emp[i]=emp[j];
         emp[j]=temp;
        }
    }
}
    printf("\nAfter soring Acording to city");
    for(i=0;i<10;i++)
    {
    printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    }
    getch();
   }

 void linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
    }
(f)     Sort the records with respect to City in descending order and print them.
Ans:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void linkfloat();
    struct employee
     {
      char name[20];
      char post[20];
      char city[20];
      int phone;
      float sallary;
     };
 void main()
 {
  struct employee emp[10];
   int i,j;
   struct employee temp;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      fflush(stdin);
      scanf("%s%s%s%d%f",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
     printf("\nbefore sorting");
     printf("Name\tPost\tCity\tPhone.No\tSallary\n");
     printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    for(i=0;i<10;i++)
    {
      for(j=0;j<10;j++)
      {
        if(strcmp(emp[i].city,emp[j].city)>0)
        {
         temp=emp[i];
         emp[i]=emp[j];
         emp[j]=temp;
        }
    }
}
    printf("\nAfter soring Acording to city");
    for(i=0;i<10;i++)
    {
    printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    }
    getch();
   }

 void linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
    }
(g)   Sort the records with respect to Tel in ascending order and print them.
Ans:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void linkfloat();
    struct employee
     {
      char name[20];
      char post[20];
      char city[20];
      int phone;
      float sallary;
     };
 void main()
 {
  struct employee emp[10];
   int i,j;
   struct employee temp;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      fflush(stdin);
      scanf("%s%s%s%d%f",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
     printf("\nbefore sorting");
     printf("Name\tPost\tCity\tPhone.No\tSallary\n");
     printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    for(i=0;i<10;i++)
    {
      for(j=0;j<10;j++)
      {
        if(emp[i].phone<emp[j].phone)
        {
         temp=emp[i];
         emp[i]=emp[j];
         emp[j]=temp;
        }
    }
}
    printf("\nAfter soring Acording to phone");
    for(i=0;i<10;i++)
    {
    printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    }
    getch();
   }

 void linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
    }

(h)   Sort the records with respect to Tel in descending order and print them.
Ans:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void linkfloat();
    struct employee
     {
      char name[20];
      char post[20];
      char city[20];
      int phone;
      float sallary;
     };
 void main()
 {
  struct employee emp[10];
   int i,j;
   struct employee temp;
   for(i=0;i<10;i++)
    {
      printf("\nEnter the name,post,city,phone No. and sallary\n");
      fflush(stdin);
      scanf("%s%s%s%d%f",&emp[i].name,&emp[i].post,&emp[i].city,&emp[i].phone,&emp[i].sallary);
    }
     printf("\nbefore sorting");
     printf("Name\tPost\tCity\tPhone.No\tSallary\n");
     printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    for(i=0;i<10;i++)
    {
      for(j=0;j<10;j++)
      {
        if(emp[i].phone>emp[j].phone)
        {
         temp=emp[i];
         emp[i]=emp[j];
         emp[j]=temp;
        }
    }
}
    printf("\nAfter soring Acording to phone");
    for(i=0;i<10;i++)
    {
    printf("\n%s\t%s\t%s\t%d\t%f\n",emp[i].name,emp[i].post,emp[i].city,emp[i].phone,emp[i].sallary);
    }
    getch();
   }

 void linkfloat()
    {
       float a=0,*b;
       b=&a;
       a=*b;
    }