nomerat daneshjo

مشاهده موضوع قبلي مشاهده موضوع بعدي اذهب الى الأسفل

nomerat daneshjo

پست من طرف mohsen في الأحد أبريل 13, 2008 9:03 am

#include
#include
#include
#include
#include
struct daneshjo{
char name[30];
int stno;
daneshjo *next;
};
struct daneshjo *first,*last,*node;
main(){
void enter();
void list();
void search();
void del();
char s[10];
while (1){
clrscr();
cout<<"\n\n\n\n\n";
cout<<" ********************************\n";
cout<<" |mohsen seraj number:84783686|\n ";
cout<<" ********************************\n\n\n\n";
gotoxy(20,15);
cout<<"------------------------------------\n";
gotoxy(20,16);
cout<<"| E)Enter Name 2 The List |";
gotoxy(20,17);
cout<<"------------------------------------\n";
gotoxy(20,18);
cout<<"| R)Remove Name From The List |";
gotoxy(20,19);
cout<<"------------------------------------\n";
gotoxy(20,20);
cout<<"| L)List View |";
gotoxy(20,21);
cout<<"------------------------------------\n";
gotoxy(20,22);
cout<<"| Q)Quit From The Program |";
gotoxy(20,23);
cout<<"------------------------------------\n";
gotoxy(20,24);
cout<<"| s)search From The Program |";
gotoxy(20,25);
cout<<"------------------------------------\n";

gotoxy(20,26);
cout<<"| Now Press : (E R L s Q): |";
gotoxy(20,27);
cout<<"------------------------------------\n";
gets(s);
*s=toupper(*s);
switch (*s){
case 'E': enter() ; break;
case 'L': list() ; break;
case 'R': del() ; break;
case 's': search ; break;
case 'Q': exit(0);
}
}
}
void enter(){
char numstr[30];
node =(struct daneshjo *) malloc(sizeof(struct daneshjo));
node -> next=NULL;
if (first == NULL)
first = last = node;
else{
last -> next = node;
last = node;
}
cout<<"\n Please Enter Name Of You'r daneshjo :";
gets(last -> name);
cout<<"\n Please Enter You'r daneshjo Number :";
gets(numstr);
last -> stno = atoi(numstr);
}
void list(){
int i;
if (first==NULL){
cout<<"\n << You'r List Is Empty >>";
getch();
return;
}
last = first;
clrscr();
gotoxy(5,4);
cout<<" Name daneshjo.Number";
gotoxy(5,5);
cout<<"-------- ----------";
i = 6;
do{
gotoxy(5,i);
printf("%s",last -> name);
gotoxy(25,i);
printf("%d",last -> stno);
i++;
last = last -> next;
}while (last!=NULL);
gotoxy(5,i++);
printf("**************************");
printf("******************");
gotoxy(10,i++);
printf("Press Any Key To Continue...");
getch();
}
void del(){
int stnumber;
gotoxy(20,14);
printf("Please Enter Number Of Your daneshjo You Want To Delete : ");
scanf("%d",&stnumber);
last = node = first;
while (last != NULL){
if (last -> stno!=stnumber){
node = last;
last = last -> next;
continue;
}
void search ();{
int stnumber;
gotoxy(1,20);
printf("Please Enter Number Of Your daneshjo You Want To search : ");
scanf("%d",&stnumber);
last = node = first;
while (last != NULL){
if (last -> stno!=stnumber){
node = last;
last = last -> next;
continue;
}
else{
if (last == first){
first=last -> next;
free(last);
free(node);
break;
}
else{
node -> next=last -> next;
free(last);
break;
}
}
}
}
}
}
avatar
mohsen
مدیر کل
مدیر کل

تعداد پستها : 129
Age : 31
آدرس پستي : فیروزکوه
Registration date : 2008-04-10

خواندن مشخصات فردي http://www.mohsenseraj65.blogfa.com

بازگشت به بالاي صفحه اذهب الى الأسفل

مشاهده موضوع قبلي مشاهده موضوع بعدي بازگشت به بالاي صفحه


 
صلاحيات هذا المنتدى:
شما نمي توانيد در اين بخش به موضوعها پاسخ دهيد