i am getting error "function exit should have a prototype"

please help me please check error in this code

Page 1 of 1

13 Replies - 1841 Views - Last Post: 30 December 2010 - 03:40 AM Rate Topic: -----

#1 cutekiller0  Icon User is offline

  • New D.I.C Head

Reputation: -33
  • View blog
  • Posts: 4
  • Joined: 27-December 10

i am getting error "function exit should have a prototype"

Posted 27 December 2010 - 06:59 AM

#include<iostream.h>
#include<stdio.h>
#include<string.h>
#include<conio.h>
main()
{
 FILE *t,*p;
 char another,choice;
  struct telephone
 {
  char name[30];
  long int code;
  long int number;
  };
  struct telephone data;
  char custname[30];
  long int n;
  long int recsize;

   t=fopen("TELEPHONE.DAT","rb+");
   if(t==NULL)
   {
       t=fopen("TELEPHONE.DAT","wb+");
	   if(t==NULL)
	   {
	     printf("The File can't open\n");
		 exit();
		 }
		 }
     printf("          TELEPHONE DIRECTORY               \n");
	 printf("          *******************               \n");

	 recsize=sizeof(data);

  while(1)
  {
	  printf("\n\n");
   printf("1.Add Records\n");
   printf("2.List Records\n");
   printf("3.Modify Records\n");
   printf("4.Finding Number\n");
   printf("5.Finding Name\n");
   printf("6.Delete Records\n");
   printf("0.Exit\n");
   printf("Your Choice:");

   fflush(stdin);
   choice=getche();

   switch(choice)
   {
   case '1':

	   fseek(t,0,SEEK_END);

	   another='y';

	   while(another=='y')
	   {
		   printf("\nEnter Customer name,Code number and Telephone number\n");
		   scanf("%s  %ld %ld",data.name,&data.code,&data.number);
		   fwrite(&data,recsize,1,t);

		   printf("Add another data(y/n):");
		   fflush(stdin);
		   another=getche();
		   printf("\n");
	   }
	   break;

   case '2':

	   rewind(t); 
	   printf("\n");
	   printf("---------------------------------------------\n");
	   printf("|   CUSTOMER      |   CODE   |  TELEPHONE   |\n");
       printf("---------------------------------------------\n");
       rewind(t);

	   while(fread(&data,recsize,1,t)==1)

	   printf("|  %-18s %-2ld %12ld    |\n\n",data.name,data.code,data.number);
	   printf("--------------------------------------------\n");
       getch();
	   

	   printf("\n");
	   break;

   case '3':
	   another='y';
	   while(another=='y')
	   {
		   printf("\nEnter name of customer to modify:");
		   scanf("%s",custname);
		   rewind(t);
		   while(fread(&data,recsize,1,t)==1)
		   {
			   if(strcmp(data.name,custname)==0)
			   {
				   printf("\nEnter new name,code and telephone number\n");
				   scanf("%s %ld &ld",data.name,&data.code,&data.number);

				   fseek(t,-recsize,SEEK_CUR);
                   fwrite(&data,recsize,1,t);
				   break;
			   }
		   }
		   printf("Modify another record(y/n):");
				   fflush(stdin);
				   another=getche();
				   printf("\n");
	   }

	   break;


   case '4':

	   another='y';
	   while(another=='y')
	   {
	   printf("\nEnter name of customer:");
	   scanf("%s",custname);

	   rewind(t);
	   while(fread(&data,recsize,1,t)==1)
	   {
	   if(strcmp(data.name,custname)==0)
	   {
		   printf("Telephone Number=%ld %ld\n",data.code,data.number);
		   getch();
	   }
	   }
		   printf("Find another number(y/n)? ");
	   fflush(stdin);
	   another=getche();
	   printf("\n");
	   }
	   break;

   case '5':

	   another='y';
	   while(another=='y')
	   {
		   printf("\nEnter number of customer:");
		   scanf("%ld",&n);

		   rewind(t);
		   while(fread(&data,recsize,1,t)==1)
		   {
		   if(data.number==n)
		   {
			   printf("The Name is %s\n",data.name);
			   getch();
		   }
		   }
		   printf("Find another name(y/n)? ");
		   fflush(stdin);
		   another=getche();
		   printf("\n");
	   }
	   break;

   case '6':

	   another='y';
	   while(another=='y')
	   {
		   printf("\nEnter name of customer to delete:");
		   scanf("%s",custname);

		   p=fopen("TEMP.DAT","wb");

		   rewind(t);
		   while(fread(&data,recsize,1,t)==1)
		   {
			   if(strcmp(data.name,custname)!=0)
				   fwrite(&data,recsize,1,p);
		   }
		   fclose(t);
		   fclose(p);

		   remove("TELEPHONE.DAT");
		   rename("TEMP.DAT","TELEPHONE.DAT");

		   t=fopen("TELEPHONE","rb+");
		        
            printf("Delete another record(y/n):");
			fflush(stdin);
			another=getche();
	   }
	   break;


  case '0':

	   printf("\n");
	   fclose(t);
	   exit();
	   }  
   }
   }


i am getting error "function 'exit' should have a prototype"
please correct code and retype it please my dear member!!!

Is This A Good Question/Topic? 0
  • +

Replies To: i am getting error "function exit should have a prototype"

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6052
  • View blog
  • Posts: 23,487
  • Joined: 23-August 08

Re: i am getting error "function exit should have a prototype"

Posted 27 December 2010 - 07:18 AM

man exit

Relevant part:

Quote

Synopsis

#include <stdlib.h>
void exit(int status);

Was This Post Helpful? 1
  • +
  • -

#3 Salem_c  Icon User is online

  • void main'ers are DOOMED
  • member icon

Reputation: 1636
  • View blog
  • Posts: 3,116
  • Joined: 30-May 10

Re: i am getting error "function exit should have a prototype"

Posted 27 December 2010 - 07:38 AM

> #include<iostream.h>
This is over 10 years out of date.

> #include<conio.h>
This is over 20 years out of date!

What fossil book / compiler / tutor are you using?

Apart from the first line, this is entirely 'C' (no C++ at all). Is that your intention?

> fflush(stdin);
Another sign of brain damage.
http://sourceforge.n...hp?title=Fflush
Was This Post Helpful? 3
  • +
  • -

#4 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6052
  • View blog
  • Posts: 23,487
  • Joined: 23-August 08

Re: i am getting error "function exit should have a prototype"

Posted 27 December 2010 - 07:39 AM

Mmmmm...copypasta.
Was This Post Helpful? 4
  • +
  • -

#5 cutekiller0  Icon User is offline

  • New D.I.C Head

Reputation: -33
  • View blog
  • Posts: 4
  • Joined: 27-December 10

Re: i am getting error "function exit should have a prototype"

Posted 27 December 2010 - 07:47 AM

now i am getting error "too few parameter in call to 'exit(int)'

guys dont look over copy paste please answer the problem

View PostJackOfAllTrades, on 27 December 2010 - 06:39 AM, said:

Mmmmm...copypasta.

now i am getting error "too few parameter in call to 'exit(int)'
Was This Post Helpful? -11
  • +
  • -

#6 newclearner  Icon User is offline

  • D.I.C Regular

Reputation: 103
  • View blog
  • Posts: 302
  • Joined: 29-September 10

Re: i am getting error "function exit should have a prototype"

Posted 27 December 2010 - 07:47 AM

And why do you think that one should not see the fact you copy pasted it.
Was This Post Helpful? 3
  • +
  • -

#7 cutekiller0  Icon User is offline

  • New D.I.C Head

Reputation: -33
  • View blog
  • Posts: 4
  • Joined: 27-December 10

Re: i am getting error "function exit should have a prototype"

Posted 27 December 2010 - 07:51 AM

View Postnewclearner, on 27 December 2010 - 06:47 AM, said:

And why do you think that one should not see the fact you copy pasted it.

its because you all are expert to answer the questions and you all just have to solve it no matter from where the question comes
Was This Post Helpful? -11
  • +
  • -

#8 newclearner  Icon User is offline

  • D.I.C Regular

Reputation: 103
  • View blog
  • Posts: 302
  • Joined: 29-September 10

Re: i am getting error "function exit should have a prototype"

Posted 27 December 2010 - 07:58 AM

View Postcutekiller0, on 27 December 2010 - 07:21 PM, said:

its because you all are expert to answer the questions
Oh really... and are you going to pay us for this?
Experts here are NOT at your service. They are here to help you if come across any issues in YOUR OWN work(not a copy pasted code).

Quote

...and you all just have to solve it no matter from where the question comes
It DOES matter where the code came from. And why do we have to solve it. Its your assignment not ours. As mentioned earlier experts here are not at your service. You just copy pasted a code and are asking us to fix to the errors, no efforts from your side, so you should be paying every single person here who replies to your posts. How about that?

This post has been edited by newclearner: 27 December 2010 - 07:59 AM

Was This Post Helpful? 3
  • +
  • -

#9 janotte  Icon User is offline

  • code > sword
  • member icon

Reputation: 990
  • View blog
  • Posts: 5,141
  • Joined: 28-September 06

Re: i am getting error "function exit should have a prototype"

Posted 27 December 2010 - 08:00 AM

*
POPULAR

View Postcutekiller0, on 27 December 2010 - 11:51 PM, said:

you all just have to solve it no matter from where the question comes


Nope, sorry, you are wrong.

I'd suggest you save everyone a lot of time and tell your teacher you copy-pasted your homework and get the fail without wasting any more of your time, our time or your teacher's time.

That's the most time efficient way to get to where you are going to end up.
Was This Post Helpful? 6
  • +
  • -

#10 cutekiller0  Icon User is offline

  • New D.I.C Head

Reputation: -33
  • View blog
  • Posts: 4
  • Joined: 27-December 10

Re: i am getting error "function exit should have a prototype"

Posted 27 December 2010 - 08:14 AM

hureee i did finally my project is ready

View Postjanotte, on 27 December 2010 - 07:00 AM, said:

View Postcutekiller0, on 27 December 2010 - 11:51 PM, said:

you all just have to solve it no matter from where the question comes


Nope, sorry, you are wrong.

I'd suggest you save everyone a lot of time and tell your teacher you copy-pasted your homework and get the fail without wasting any more of your time, our time or your teacher's time.

That's the most time efficient way to get to where you are going to end up.

no just be quiet my work is donr by my self
Was This Post Helpful? -11
  • +
  • -

#11 Guest_Mohit*


Reputation:

Re: i am getting error "function exit should have a prototype"

Posted 29 December 2010 - 03:50 AM

View Postcutekiller0, on 27 December 2010 - 07:14 AM, said:

hureee i did finally my project is ready

View Postjanotte, on 27 December 2010 - 07:00 AM, said:

View Postcutekiller0, on 27 December 2010 - 11:51 PM, said:

you all just have to solve it no matter from where the question comes


Nope, sorry, you are wrong.

I'd suggest you save everyone a lot of time and tell your teacher you copy-pasted your homework and get the fail without wasting any more of your time, our time or your teacher's time.

That's the most time efficient way to get to where you are going to end up.

no just be quiet my work is donr by my self


----\
/
/
/
Hey how did u sole the last error!
please tell me today ., if possible
Was This Post Helpful? -4

#12 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6052
  • View blog
  • Posts: 23,487
  • Joined: 23-August 08

Re: i am getting error "function exit should have a prototype"

Posted 29 December 2010 - 04:14 AM

Hey Mohit...how about doing your own work? Don't be yet another copy/paste robot. You and your ilk will fail when the tests come...unless your idiot instructors that haven't figured out you're cheating just give the same tests every year, which would then no doubt be posted on some Indian "cheat your way through school" website. Wouldn't surprise me in the least, actually.
Was This Post Helpful? 3
  • +
  • -

#13 Guest_Mohit*


Reputation:

Re: i am getting error "function exit should have a prototype"

Posted 29 December 2010 - 09:45 AM

View PostJackOfAllTrades, on 29 December 2010 - 03:14 AM, said:

Hey Mohit...how about doing your own work? Don't be yet another copy/paste robot. You and your ilk will fail when the tests come...unless your idiot instructors that haven't figured out you're cheating just give the same tests every year, which would then no doubt be posted on some Indian "cheat your way through school" website. Wouldn't surprise me in the least, actually.


/
/
/
Hey thanks Jack.... for telling Indian what they are. We know better what we are, what we have to do and in coming year u will see what we are going to achieve.

I appreciate your programming skills and also happy that you make me feel realize that how lazy person i m.

At last i want to say that , please if u are giving an reply or advice or what u do., please go to name only not the religion and the country.

:) I know u r best and keep praying for the best of u in nxt year.

Dear Frnd Merry Christmas and Happy New Year :)
Was This Post Helpful? 2

#14 moopet  Icon User is offline

  • binary decision maker
  • member icon

Reputation: 339
  • View blog
  • Posts: 1,185
  • Joined: 02-April 09

Re: i am getting error "function exit should have a prototype"

Posted 30 December 2010 - 03:40 AM

View PostMohit, on 29 December 2010 - 03:45 PM, said:

please if u are giving an reply or advice or what u do., please go to name only not the religion and the country.

Do not start this.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1