Hi i have this program that is about library management system in C++ language and i want to convert it to C but i dont know what to do. if someone could help me i would be thankful.

#include<stdio.h>
#include<conio.h>
#include<iostream.h>
#include<stdlib.h>
#include<string.h>
#define MAX 100
struct book{
char bookname[80];
char title[80];
int id;
int jeld;
}b[MAX];
struct mem{
char memname[80];
char memlname[80];
int id;
int tel;
}m[MAX];
struct amanat{
int id;
char name[80];
char lname[80];
char bname[80];
char date1[80];
char d[80];
}a[10];
int menu()
{
int c;
char s[10];

cout<<"1)Input Information Book\n";
cout<<"2)Input Information Member\n";
cout<<"3)Input Information Amanat\n";
cout<<"4) Search Book\n";
cout<<"5)Show Information Book\n";
cout<<"6)Show Information Member\n";
cout<<"7)Show Information Amanat\n";
cout<<"8)Delete book\n";
cout<<"9)sort book\n";
cout<<"10)exit\n";
do{
cout<<"Please Enter Select menu(1-10): ";
cin>>s;
c=atoi(s);
}while(c<0||c>10);
return c;
}
void inputbook(int);
void inputmem(int);
void inputamant(int);
int search(int [],int,int);
void showbook(int);
void showmem(int);
void showamant(int);
void del(int);
void sort(int);
void main()
{
clrscr();
int s,n,m,v,x,y[MAX],i;
for(;;)
{
clrscr();
s=menu();
switch(s)
{
case 1:
cout<<"Please Enter number book: ";
cin>>n;
inputbook(n);
break;
case 2:
cout<<"Please Enter number Member: ";
cin>>m;
inputmem(m);
break;
case 3:
cout<<"Please Enter number Member: ";
cin>>v;
inputamant(v);
break;
case 4:
for(i=1;i<=n;i++)
y[i]=b[i].id;
cout<<"Please Enter id book for search: ";
cin>>x;
if(search(y,n,x)==-1)
cout<<"Not exist\n";
else
cout<<"Exist\n";
getch();
break;
case 5:
showbook(n);
break;
case 6:
showmem(m);
break;
case 7:
showamant(v);
break;
case 8:
del(n);
break;
case 9:
sort(n);
break;
case 10:
exit(0);
}
}
}
void inputbook(int n)
{
int i;
FILE *p;
p=fopen("book.dat","w+");
if(!p){
cout<<"Cannot open file\n";
getch();
exit(0);
}

cout<<"Please Enter Information Book\n";
cout<<"-------------------------------\n";
for(i=1;i<=n;i++)
{
cout<<"Please Enter Book Name: ";
cin>>b[i].bookname;
cout<<"Please Enter title Book: ";
cin>>b[i].title;
cout<<"Please Enter id Book: ";
cin>>b[i].id;
cout<<"Please Enter Number Jeld: ";
cin>>b[i].jeld;
fwrite(&b[i],sizeof(struct book),1,p);
}
getch();
}
void inputmem(int n)
{
int i;
FILE *p;
p=fopen("Member.dat","w+");
if(!p){
cout<<"Cannot open file\n";
getch();
exit(0);
}
for(i=1;i<=n;i++)
{
cout<<"Please Enter Member Name: ";
cin>>m[i].memname;
cout<<"Please Enter Member Lname: ";
cin>>m[i].memlname;
cout<<"Please Enter id Member: ";
cin>>m[i].id;
cout<<"Please Enter Telephon Number: ";
cin>>m[i].tel;
fwrite(&m[i],sizeof(struct mem),1,p);
}
getch();
}
void inputamant(int n)
{
int i;
FILE *p;
p=fopen("Member.dat","w+");
if(!p){
cout<<"Cannot open file\n";
getch();
exit(0);
}
for(i=1;i<=n;i++)
{
cout<<"Please Enter Member Name: ";
cin>>a[i].name;
cout<<"Please Enter Member Lname: ";
cin>>a[i].lname;
cout<<"Please Enter id Member: ";
cin>>a[i].id;
cout<<"Please Enter Book Name: ";
cin>>a[i].bname;
cout<<"Please Enter Date Resive: ";
cin>>a[i].date1;
cout<<"Please Enter date Send: ";
cin>>a[i].d;
fwrite(&a[i],sizeof(struct amanat),1,p);
}
getch();
}
void showbook(int n)
{
int i;
cout<<"-----------Print Information Book---------\n";
for(i=1;i<=n;i++)
if(b[i].bookname[0])
{
cout<<"Please Enter Book Name: ";
cout<<b[i].bookname;
cout<<"\n";
cout<<"Please Enter title Book: ";
cout<<b[i].title;
cout<<"\n";
cout<<"Please Enter id Book: ";
cout<<b[i].id;
cout<<"\n";
cout<<"Please Enter Number jeld: ";
cout<<b[i].jeld;
cout<<"\n";
}

getch();
}
void showmem(int n)
{
int i;
cout<<"---------show Member--------\n";
for(i=1;i<=n;i++)
{
cout<<"Please Enter Member Name: ";
cout<<m[i].memname<<"\n";
cout<<"Please Enter Member Lname: ";
cout<<m[i].memlname<<"\n";
cout<<"Please Enter id Member: ";
cout<<m[i].id<<"\n";
cout<<"Please Enter Telephon Number: ";
cout<<m[i].tel<<"\n";
}
getch();
}
void showamant(int n)
{
int i;
for(i=1;i<=n;i++)
{
cout<<"Please Enter Member Name: ";
cout<<a[i].name<<"\n";
cout<<"Please Enter Member Lname: ";
cout<<a[i].lname<<"\n";
cout<<"Please Enter id Member: ";
cout<<a[i].id<<"\n";
cout<<"Please Enter Book Name: ";
cout<<a[i].bname<<"\n";
cout<<"Please Enter Date Resive: ";
cout<<a[i].date1<<"\n";
cout<<"Please Enter date Send: ";
cout<<a[i].d<<"\n";

}
getch();
}
int search(int y[],int n,int x)
{
int i;
for(i=1;i<=n;i++)
if(y[i]==x)
return i;
return -1;
}
void del(int n)
{
int i;
char s[50];
cout<<"Please Enter book name is delete(www.mspsoft.ir): ";
cin>>s;
for(i=1;i<=n;i++)
if(0==strcmp(b[i].bookname,s))
{
b[i].bookname[0]='\0';
}
}

void sort(int n)
{
int i,j;
char item[21];
for(i=n;i>=1;i--)
for(j=1;j<=i;j++)
if(strcmp(b[j].bookname,b[j+1].bookname)>0)
{
strcpy(item,b[j].bookname);
strcpy(b[j].bookname,b[j+1].bookname);
strcpy(b[j+1].bookname,item);
}
}

I'll help, but you've got to learn how to use code tags first. Not too many folks want to look at unformatted code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.