Your SlideShare is downloading. ×
Wildlife conservation project management  adri jovin
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Wildlife conservation project management adri jovin

669
views

Published on

This was my Software Engineering Mini-project while I was doing my UG in St.Xavier's Catholic College of Engineering

This was my Software Engineering Mini-project while I was doing my UG in St.Xavier's Catholic College of Engineering

Published in: Education, Technology, Business

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
669
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
18
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. #include<iostream.h><br /> #include<stdio.h><br /> #include<conio.h><br /> #include<dos.h><br /> #include<string.h><br /> void main()<br /> {<br /> int iCh1,iInc;<br /> e:<br /> clrscr();<br /> /* To Display Main menu */<br /> gotoxy(26,40);<br /> textcolor(9);<br /> cprintf(" SOFTWARE ENGINEERING PROJECT" );<br /> gotoxy(32,44);<br /> textcolor(19);<br /> cprintf(" BATCH-1(2006-07)" );<br /> gotoxy(23,42);<br /> cprintf(" WILDLIFE CONSERVATION MANAGEMENT SYSTEM ( WLCPM-2007)" );<br /> gotoxy(8,45);<br /> textcolor(9);<br /> /* To Display date and time */<br /> cprintf(" DATE : %s " ,__DATE__);<br /> gotoxy(55,45);<br /> cprintf(" TIME : %s " ,__TIME__);<br /> for(iInc=0;iInc<=30;iInc++)<br /> {<br /> gotoxy(20,iInc);<br /> textcolor(7);<br /> cprintf(" -" );<br /> }<br /> for(iInc=0;iInc<80;iInc++)<br /> {<br /> gotoxy(iInc,30);<br /> textcolor(7);<br /> cprintf(" |" );<br /> }<br /> gotoxy(30,8);<br /> textcolor(9);<br /> /* Main menu */<br /> cprintf(" WILDLIFE CONSERVATION MANAGEMENT SYSTEM (WLCPM-2007)" );<br /> gotoxy(30,10);<br /> textcolor(19);<br /> cprintf(" 1.FOREST CONSERVATION" );<br /> gotoxy(30,12);<br /> cprintf(" 2.DESERT CONSERVATION" );<br /> gotoxy(30,14);<br /> cprintf(" 3.EXIT" );<br /> gotoxy(30,18);<br /> textcolor(9);<br /> cprintf(" ENTER YOUR CHOICE:" );<br /> scanf(" %d" ,&iCh1);<br /> if<br /> (iCh1==3)<br /> {<br /> /* To exit from the system */<br /> gotoxy(30,28);<br /> textcolor(4);<br /> cprintf(" SYSTEM SHUTTING DOWN" );<br /> sleep(3);<br /> gotoxy(26,40);<br /> printf(" SOFTWARE ENGINEERING PROJECT" );<br /> gotoxy(8,42);<br /> printf(" WILDLIFE CONSERVATION MANAGEMENT SYSTEM ( WLCPM-2007)" );<br /> gotoxy(8,45);<br /> printf(" DATE : %s " ,__DATE__);<br /> gotoxy(55,45);<br /> printf(" TIME : %s " ,__TIME__);<br /> //exit(0);<br /> }<br /> else{<br /> /* Declarations of Variables */<br /> FILE *fp,*ft;<br /> char cAns,cChoice;<br /> struct zoo<br /> {<br /> char offspr[2],anim_history[50],an_name[30],keeper_nm[20],cellid[4],an_sex[2];<br /> int anim_age,offno;<br /> float wt,offrat,inbreed,food_s,food_c;<br /> };<br /> struct zoo e;<br /> char cell_id[4];<br /> int iF=0,iC=0,iF1=0;<br /> long int lRecsize;<br /> fp=fopen(" zm.dat" ," rb+" );<br /> if(fp==NULL)<br /> {<br /> fp=fopen(" zm.dat" ," wb+" );<br /> if(fp==NULL)<br /> {<br /> puts(" Cannot Open file" );<br /> //exit();<br /> }<br /> }<br /> lRecsize=sizeof(e);<br /> while(1)<br /> {<br /> clrscr();<br /> textcolor(4);<br /> if(iCh1==1) {<br /> gotoxy(30,8);<br /> textcolor(4);<br /> cprintf(" ANIMAL MENU" ); }<br /> else if(iCh1==2) {<br /> gotoxy(30,8);<br /> textcolor(4);<br /> cprintf(" BIRD MENU" ); }<br /> gotoxy(26,40);<br /> textcolor(4);<br /> cprintf(" SOFTWARE ENGINEERING PROJECT" );<br /> gotoxy(32,44);<br /> textcolor(19);<br /> cprintf(" BATCH-1(2006-07)" );<br /> gotoxy(23,42);<br /> textcolor(19);<br /> cprintf(" WILDLIFE CONSERVATION MANAGEMENT SYSTEM ( WLCPM-2007 )" );<br /> gotoxy(8,45);<br /> textcolor(4);<br /> cprintf(" DATE : %s " ,__DATE__);<br /> gotoxy(55,45);<br /> cprintf(" TIME : %s " ,__TIME__);<br /> for(iInc=0;iInc<=30;iInc++)<br /> {<br /> gotoxy(20,iInc);<br /> textcolor(7);<br /> cprintf(" -" );<br /> }<br /> for(iInc=0;iInc<=80;iInc++)<br /> {<br /> gotoxy(iInc,30);<br /> textcolor(7);<br /> cprintf(" |" );<br /> }<br /> gotoxy(30,10);<br /> textcolor(19);<br /> cprintf(" 1.ADD " );<br /> gotoxy(30,12);<br /> cprintf(" 2.DISPLAY" );<br /> gotoxy(30,14);<br /> cprintf(" 3.MODIFY" );<br /> gotoxy(30,16);<br /> cprintf(" 4.DELETE" );<br /> gotoxy(30,18);<br /> cprintf(" 5.EXIT" );<br /> gotoxy(30,20);<br /> textcolor(4);<br /> cprintf(" SELECT YOUR OPTION: " );<br /> fflush(stdin);<br /> cChoice=getche();<br /> clrscr();<br /> gotoxy(25,8);<br /> textcolor(5);<br /> switch(cChoice)<br /> {<br /> case '1':<br /> //To add a record<br /> w:<br /> printf(" ENTER CELL ID( 3 DIGIT NO.): " );<br /> scanf(" %s" ,cell_id);<br /> rewind(fp);<br /> //Checking for unique id<br /> while(fread(&e,lRecsize,1,fp)==1)<br /> {<br /> if(strcmp(e.cellid,cell_id)==0)<br /> {<br /> iF=1;<br /> printf(" THE ID ALREADY EXISTS" );<br /> goto w;<br /> }}<br /> if(iF==0||fread(&e,lRecsize,1,fp)==0)<br /> {<br /> fseek (fp,0,SEEK_END);<br /> strcpy(e.cellid,cell_id);<br /> a3:<br /> printf(" ENTER ANIMAL NAME: " );<br /> scanf(" %s" ,e.an_name);<br /> if(strlen(e.an_name)>30||strlen(e.an_name)<3)<br /> goto a3;<br /> printf(" ENTER ZOO KEEPER NAME: " );<br /> scanf(" %s" ,e.keeper_nm); <br /> p:<br /> printf(" ENTER SEX [M/F]: " );<br /> scanf(" %s" ,e.an_sex);<br /> if(strlen(e.an_sex)>1)<br /> goto p;<br /> f:<br /> printf(" ENTER AGE : " );<br /> scanf(" %d" ,&e.anim_age);<br /> if(e.anim_age<0||e.anim_age>100)<br /> goto f; <br /> a5:<br /> printf(" OFFSPRING [P/A]:" );<br /> scanf(" %s" ,&e.offspr);<br /> if(strlen(e.offspr)>1)<br /> goto a5;<br /> printf(" ENTER NO. OF OFFSPRING: " );<br /> scanf(" %d" ,&e.offno);<br /> printf(" FOOD SUPPLIED( IN KG): " );<br /> scanf(" %f" ,&e.food_s);<br /> printf(" FOOD CONSUMED( IN KG): " );<br /> scanf(" %f" ,&e.food_c);<br /> a2:<br /> printf(" ANIMAL DETAILS(IF ANY) (Don't leave space,use '_'): " );<br /> scanf(" %s" ,e.anim_history);<br /> if(strlen(e.anim_history)>50)<br /> goto a2;<br /> fwrite(&e,lRecsize,1,fp);<br /> /*Flushes a stream On success returns 0 , On error returns EOF */<br /> fflush(stdin);<br /> }<br /> break;<br /> case '2':<br /> //Searching and displaying all the infor<br /> // mation by id<br /> textcolor(7);<br /> printf(" ENTER CELL ID: " );<br /> scanf(" %s" ,cell_id);<br /> rewind(fp);<br /> while(fread(&e,lRecsize,1,fp)!=0)<br /> {<br /> if(strcmp(e.cellid,cell_id)==0)<br /> { iC=1;<br /> clrscr();<br /> //Display according to Main menu<br /> gotoxy(0,20);<br /> //FOREST CONSERVATION<br /> if(iCh1==1){<br /> printf(" DETAILS OF THE ANIMAL:%s" ,strupr(e.an_name));<br /> printf(" _____________________________________________________________________ " );<br /> printf(" NAME : %s CELL ID : %s ZOO KEEPER NAME : %s SEX: %s AGE : %d OFFSPRING: %s OFFSPRING NO. : %d OFFSPRING RATIO : %f INBREED RATIO : %f FOOD SUPPLIED : %f FOOD CONSUMED : %f ANIMAL DETAILS: %s" ,strupr(e.an_name),strupr(e.cellid),strupr(e.keeper_nm),strupr(e.an_sex),e.anim_age,strupr(e.offspr),e.offno,(e.offno/13.33*6.2),(e.offno*12.66/17.3574),e.food_s,e.food_c,strupr(e.anim_history));<br /> printf(" _____________________________________________________________________ " );<br /> getch(); }<br /> //DESERT CONSERVATION<br /> else if(iCh1==2){<br /> printf(" DETAILS OF BIRD:%s" ,strupr(e.an_name));<br /> printf(" _____________________________________________________________________ " );<br /> printf(" NAME : %s CELL ID : %s ZOO KEEPER NAME : %s AGE: %d SEX : %s OFFSPRING: %s OFFSPRING NO. : %d OFFSPRING RATIO : %f INBREED RATIO : %f FOOD SUPPLIED : %f FOOD CONSUMED : %f ANIMAL DETAILS: %s" ,strupr(e.an_name),strupr(e.cellid),strupr(e.keeper_nm),e.anim_age,strupr(e.an_sex),strupr(e.offspr),e.offno,(e.offno/13.33*6.2),(e.offno*12.66/17.3574),e.food_s,e.food_c,strupr(e.anim_history));<br /> printf(" _____________________________________________________________________ " );<br /> getch(); }<br /> }<br /> }<br /> if(iC==0)<br /> {<br /> printf(" RECORD DOESN'T EXISTS.." );<br /> getch();<br /> }iC=0;<br /> break;<br /> case '3':<br /> //Searching and modifying Records by id<br /> cAns='y';<br /> while(cAns=='y')<br /> {<br /> printf(" ENTER CELL ID: " );<br /> scanf(" %s" ,cell_id);<br /> rewind(fp);<br /> while(fread(&e,lRecsize,1,fp)==1)<br /> {<br /> if(strcmp(e.cellid,cell_id)==0)<br /> {<br /> b:<br /> printf(" ENTER ANIMAL NAME: %s : " ,strupr(e.an_name));<br /> scanf(" %s" ,e.an_name);<br /> if(strlen(e.an_name)>20||strlen(e.an_name)<3)<br /> goto b;<br /> b1:<br /> printf(" ENTER SEX : %s : " ,strupr(e.an_sex));<br /> scanf(" %s" ,e.an_sex);<br /> if(strlen(e.an_sex)>1)<br /> goto b1;<br /> r:<br /> printf(" ENTER AGE: %d : " ,e.anim_age);<br /> scanf(" %d" ,&e.anim_age);<br /> if(e.anim_age<1||e.anim_age>100)<br /> goto r;<br /> ad:<br /> printf(" OFFSPRING : %s : " ,strupr(e.offspr));<br /> scanf(" %s" ,e.offspr);<br /> if(strlen(e.offspr)<1)<br /> goto ad;<br /> printf(" ENTER NO. OF OFFSPRING: %d :" ,e.offno);<br /> scanf(" %d" ,&e.offno);<br /> printf(" ENTER FOOD SUPPLIED(IN KG): %f :" ,e.food_s);<br /> scanf(" %f" ,&e.food_s);<br /> printf(" FOOD CONSUMED( IN KG): " );<br /> scanf(" %f" ,&e.food_c);<br /> b5:<br /> printf(" ANIMAL DETAILS( IF ANY ) (Dont leave space,use'_'instead)': %s : " ,e.anim_history);<br /> scanf(" %s" ,e.anim_history);<br /> if(strlen(e.anim_history)>50)<br /> goto b5;<br /> fseek(fp,-lRecsize,SEEK_CUR); //Repositions the file pointer of a stream<br /> fwrite(&e,lRecsize,1,fp);<br /> printf(" RECORD MODIFIED " );<br /> break;<br /> }<br /> }<br /> printf(" DO U WANT TO MODIFY ANY RECORD[y/n]" );<br /> /*Flushes a stream On success returns 0 , On error returns EOF */<br /> fflush(stdin);<br /> cAns=getche();<br /> }<br /> break;<br /> case '4':<br /> //Searching and deleting records by id<br /> cAns='y';<br /> while(cAns=='y')<br /> {<br /> printf(" ENTER CELL ID TO DELETE RECORD : " );<br /> scanf(" %s" ,cell_id);<br /> ft=fopen(" temp.dat" ," wb" );<br /> rewind(fp); //Repositions file pointer to stream's beginning<br /> while(fread(&e,lRecsize,1,fp)!=0)<br /> {<br /> if(strcmp(e.cellid,cell_id)!=0) {<br /> fwrite(&e,lRecsize,1,ft);<br /> }<br /> else {<br /> iF1=1;<br /> printf(" RECORD DELETED SUCCESSFULLY" );<br /> }<br /> }<br /> if(iF1!=1){iF1=0;<br /> printf(" NO SUCH RECORD FOUND" );}<br /> fclose(fp);<br /> fclose(ft);<br /> remove(" zm.dat" );<br /> rename(" temp.dat" ," zm.dat" );<br /> fp=fopen(" zm.dat" ," rb+" );<br /> printf(" DO U WANT TO DELETE ANOTHER RECORD[y/n]" );<br /> fflush(stdin);<br /> cAns=getche();<br /> }<br /> break;<br /> case '5':<br /> fclose(fp);<br /> goto e;<br /> }<br /> }<br /> }<br /> }<br />

×