koran892
شنبه 23 دی 1391, 19:25 عصر
من یه کد نوشتم برای تاکسی تلفنی
موقع ران شدن پیام میده و اجرا نمیشه
کسی میتونه کمک کنه اشکالش رفع بشه
مرسی
 
#include<iostream.h>
  
#include<conio.h>
  
#include<stdlib.h>
  
#include<string.h>
  
struct taxi_tell
  
{
  
char name[30];
  
int code;
  
char address;
  
int telphone;
  
int pay;
  
char magsad[100];
  
};
  
taxi_tell ms;
  
int k=0;
  
void add()
  
{clrscr();
  
cout<<"enter code :";
  
cin>>ms[k].code;
  
cout<<"enter name :";
  
cin>>ms[k].name;
  
cout<<"enter address :";
  
cin>>ms[k].address;
  
cout<<"enter telphone :";
  
cin>>ms[k].telphone;
  
k++;
  
}
  
void search()
  
{int c,found=0,i
  
clrscr();
  
cout<<"enter code:";
  
cin>>c;
  
for (i=0;i<k;i++)
  
if(ms[i].code==c)
  
{found=1;
  
cout<<ms[i].code<<"****"<<ms[i].name<<"****"<<ms[i].address<<"****"<<ms[i].telphone;
  
}
  
if (found==0) cout<<"not found";
  
getch();
  
}
  
void edit()
  
{int p,i;
  
cout<<"enter code:";
  
cin>>p;
  
cout<<"\n enter name:";
  
cin>>ms[p].name;
  
cout<<"\n enter address:";
  
cin>>ms[p].address;
  
cout<<"\n enter telphone:";
  
cin>>ms[p].telphone;
  
}
  
void sortcode()
  
{int i,j;
  
taxi_tell t;
  
for (i=k-2;i>=0;i--)
  
for (j=0;j<=i;j++)
  
if(ms[j].code<ms[j+1].code)
  
{
  
t=ms[j];ms[j]=ms[j+1];ms[j+1]=t;
  
}
  
}
  
void hazf()
  
{int p,i;
  
list();
  
cout<<"enter code:";
  
cin>>p;
  
for(i=p;i<k;i++)
  
ms[i]=ms[i+1]
  
k--;
  
}
  
void main()
  
{
  
int x;
  
while(1)
  
{
  
clrscr();
  
cout<<"1-add new moshtarak \n";
  
cout<<"2-sortcode \n";
  
cout<<"3-search \n";
  
cout<<"4-edit \n";
  
cout<<"6-hazt \n";
  
cout<<"7-exit \n";
  
cout<<"enter your choice(1-7):";
  
cin>>x;
  
switch(x)
  
case 1:add();break;
  
case 2:sortcode();break;
  
case 3:search();break;
  
case 4:edit();break;
  
case 6:hazf();break;
  
case 7:return ;
  
defualt:
  
cout<<"wrong choice";
  
getch();
  
{
{
موقع ران شدن پیام میده و اجرا نمیشه
کسی میتونه کمک کنه اشکالش رفع بشه
مرسی
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
struct taxi_tell
{
char name[30];
int code;
char address;
int telphone;
int pay;
char magsad[100];
};
taxi_tell ms;
int k=0;
void add()
{clrscr();
cout<<"enter code :";
cin>>ms[k].code;
cout<<"enter name :";
cin>>ms[k].name;
cout<<"enter address :";
cin>>ms[k].address;
cout<<"enter telphone :";
cin>>ms[k].telphone;
k++;
}
void search()
{int c,found=0,i
clrscr();
cout<<"enter code:";
cin>>c;
for (i=0;i<k;i++)
if(ms[i].code==c)
{found=1;
cout<<ms[i].code<<"****"<<ms[i].name<<"****"<<ms[i].address<<"****"<<ms[i].telphone;
}
if (found==0) cout<<"not found";
getch();
}
void edit()
{int p,i;
cout<<"enter code:";
cin>>p;
cout<<"\n enter name:";
cin>>ms[p].name;
cout<<"\n enter address:";
cin>>ms[p].address;
cout<<"\n enter telphone:";
cin>>ms[p].telphone;
}
void sortcode()
{int i,j;
taxi_tell t;
for (i=k-2;i>=0;i--)
for (j=0;j<=i;j++)
if(ms[j].code<ms[j+1].code)
{
t=ms[j];ms[j]=ms[j+1];ms[j+1]=t;
}
}
void hazf()
{int p,i;
list();
cout<<"enter code:";
cin>>p;
for(i=p;i<k;i++)
ms[i]=ms[i+1]
k--;
}
void main()
{
int x;
while(1)
{
clrscr();
cout<<"1-add new moshtarak \n";
cout<<"2-sortcode \n";
cout<<"3-search \n";
cout<<"4-edit \n";
cout<<"6-hazt \n";
cout<<"7-exit \n";
cout<<"enter your choice(1-7):";
cin>>x;
switch(x)
case 1:add();break;
case 2:sortcode();break;
case 3:search();break;
case 4:edit();break;
case 6:hazf();break;
case 7:return ;
defualt:
cout<<"wrong choice";
getch();
{
{