Thursday, 18 January 2018

Learn C language Part -40 SQL ORACLE DATABASE STRUCTURE IN C LANGUAGE





#include <stdio.h>

#include <conio.h>

#include <string.h>

struct employee

{

int id ;

char name[50];

float salary;

char department[50] ;



};



main()



{





int i;

struct employee e1[5];



e1[0].id=101;



strcpy(e1[0].name,"Ali");



e1[0].salary=50000;



strcpy(e1[0].department,"HR");





//2ND RECORD..........................



e1[1].id=102;



strcpy(e1[1].name,"BILAL");



e1[1].salary=60000;



strcpy(e1[1].department,"IT");



//3rd RECORD..........................



e1[2].id=103;



strcpy(e1[2].name,"Daniyal");



e1[2].salary=40000;



strcpy(e1[2].department,"Marketing");



//3rd RECORD..........................



e1[3].id=104;



strcpy(e1[3].name,"Eraj");



e1[3].salary=30000;



strcpy(e1[3].department,"Admin");



//4th RECORD..........................



e1[4].id=105;



strcpy(e1[4].name,"faisal");



e1[4].salary=20000;



strcpy(e1[4].department,"Admin");







l1:



printf("\nID\tName\t\tSalary\t\tDepatment\t\n\n");



for(i=0;i<5;i++)

{

printf("\n-----------------------------------------------------------\n");

printf("%d\t%s\t\t%.2f\t\t%s\t",e1[i].id,e1[i].name,e1[i].salary,e1[i].department);

printf("\n");

}







printf("\n-----------------------------------------------------------\n");

printf("Enter the id: ");

int n;

scanf("%d",&n);



for(i=0;i<5;i++)

{



if(e1[i].id==n)

{



printf("\nID\tName\t\tSalary\t\tDepatment\t\n\n");

printf("\n-----------------------------------------------------------\n");

printf("%d\t%s\t\t%.2f\t\t%s\t",e1[i].id,e1[i].name,e1[i].salary,e1[i].department);



printf("\n");

n=-1;

break;

}



}



if(n!=-1)

{

printf("\n No Records found......");

}



printf("\nDo you want to continue......{y/n}\n");

char c;

scanf("%c",&c);

c=getchar();

if(c=='y')

{

printf("\n\n");

goto l1;

}













}

No comments:

Post a Comment

Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC

Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...