ter
transact_cancelticket (
    sttx const& txn,
    transactionengineparams params,
    transactionengine* engine)
{
#if ripple_enable_tickets
    return cancelticket (txn, params, engine).apply ();
#else
    return temdisabled;
#endif
}
Beispiel #2
0
int main() {
	int key, menuitem, ent, id;
	menuitem = 0;
	initscr();
	drawmenu(menuitem);
	keypad(stdscr,TRUE);
	
	noecho();
	do {
		key = getch();
		switch(key) {
			case KEY_DOWN: menuitem++;
			if(menuitem > MENUMAX-1) 
				menuitem = 0;
			break;

			case KEY_UP: menuitem--;
			if(menuitem < 0) 
				menuitem = MENUMAX-1;
			break;

			default: 
			break;

		}

		drawmenu(menuitem);
		
		ent = getch();
	
		if(menuitem == 0 && ent == KEY_RIGHT) { 
			login();
			refresh();
		}
		else if(menuitem == 1 && ent == KEY_RIGHT) {
			register_id();
			refresh();
		}
		else if(menuitem == 2 && ent == KEY_RIGHT) { 
			findtrain();
			refresh();
		}
		else if(menuitem == 3 && ent == KEY_RIGHT) { 
			printw("Enter train id\n");			
			scanw("%d", &id);
			CheckAvailibility(id);
			refresh();
		}	
		else if(menuitem == 4 && ent == KEY_RIGHT) { 
			cancelticket();
			refresh();
		}
		else if(menuitem == 5 && ent == KEY_RIGHT) { 
			DisplayQueueac();
			refresh();
		}
		else if(menuitem == 6 && ent == KEY_RIGHT) { 
			DisplayQueuesl();
			refresh();
		}
		else if(menuitem == 7 && ent == KEY_RIGHT) { 
			exit(1);
		}
	}	
	while(key != '\n');
		echo();      /*Shows the text*/
	
	endwin();
	return 0;

}
Beispiel #3
0
int main(){
	FILE *fp;
	char source[20],destination[20],filename[20],filename2[20],deleted[20];
	int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	int n,t_date,t_month,t_year,date,month,year,t,bus_no,seat_no;
	do{
		start=readbus(start);
		printf("*---------------------------------------------------------------------*\n");
		printf("*       1.Information about all buses                                 *\n");
		printf("*       2.Available buses between one station to another station      *\n");					//following operations can be done
		printf("*       3.Reserve ticket for a particular bus                         *\n");										//by using this program						
		printf("*       4.Cancel ticket                                               *\n");
		printf("*       5.exit                                                        *\n");
		printf("*---------------------------------------------------------------------*\n");
		printf("Enter your choice\t-->");
		fflush(stdin);
		scanf("%d",&n);
		n=checkinteger(n);
		t=n;
		if(n==3)
		n=2;
			switch(n){																	//operations have done by using switch case
				case 1:
					display_all(start);												 
					break;
				case 2:	
					fflush(stdin);																		
					fp=fopen("todaydate.txt","r");									//read the today date by using file "todaydate.txt"
					if(fp==NULL)
						printf("can't open file\n");
					else
					while(fscanf(fp,"%d%d%d",&t_date,&t_month,&t_year)!=EOF);		//scan date,month,year by user to check availability
					printf("Enter your source station\t-->");
					scanf("%s",source);
					printf("Enter your destination\t-->");									//scan source,desetination stations by user
					scanf("%s",destination);
					int i=1;
					while(i){
						fflush(stdin);
						printf("Enter your date of journey\t-->");
						scanf("%d",&date);
						date=checkinteger(date);
						printf("Enter your month of journey\t-->");
						fflush(stdin);
						scanf("%d",&month);
						month=checkinteger(month);
						printf("Enter your year of journey\t-->");
						fflush(stdin);
						scanf("%d",&year);
						year=checkinteger(year);
						if(year%4==0)
						a[1]=29;
						if(month<=12&&month>0&&date<=a[month-1]){
							if(year==t_year){
								if(month==t_month){
									if(date>=t_date)
									i=0;
									else
									i=1;
								}
								else if(month>t_month)									//check the date if it is right or wrong
								i=0;
								else
								i=1;
							}
							else if(year>t_year)
							i=0;
							else
							i=1;
						}
					}
					assign(date,month,year);
					checkbus(start,source,destination);
					if(t==2)
					break;
				case 3:
					fflush(stdin);
					printf("Enter busno to reserve\t-->");
					fflush(stdin);
					scanf("%d",&bus_no);
					bus_no=checkinteger(bus_no);
					t=reserve(bus_no);
					if(t!=0){
					fp=fopen("filename.txt","w");
					fprintf(fp,"%d%d%d%d",date,month,year,bus_no);						//file created by "datemonthyearbusno.txt"
					fclose(fp);
					fp=fopen("filename.txt","r");
					fscanf(fp,"%s",filename2);
					fclose(fp);
					strcat(filename2,".txt");
					fp=fopen(filename2,"a");
					if(fp==NULL)
					printf("can't open file\n");
					fclose(fp);
					seatsallocation(bus_no,filename2);
					}
					break;
				case 4:
						printf("Enter your date of journey\t-->");
						fflush(stdin);
						scanf("%d",&date);
						date=checkinteger(date);
						printf("Enter your month of journey\t-->");
						fflush(stdin);
						scanf("%d",&month);
						month=checkinteger(month);
						printf("Enter your year of journey\t-->");
						fflush(stdin);
						scanf("%d",&year);
						year=checkinteger(year);
						printf("enter bus no\t-->");
						fflush(stdin);
						scanf("%d",&bus_no);
						printf("enter seat_no\t-->");
						scanf("%d",&seat_no);
						seat_no=checkinteger(seat_no);
						fp=fopen("filename.txt","w");
						fprintf(fp,"%d%d%d%d",date,month,year,bus_no);			//ticket is cancell on "datemonthyearbusno.txt"
						fclose(fp);
						fp=fopen("filename.txt","r");
						fscanf(fp,"%s",deleted);
						fclose(fp);;
						strcat(deleted,".txt");
						cancelticket(deleted,seat_no);
						printf("\n:::Ticket cancelled on your date:::\n\n");
					break;		
			}
			ptr=start;
			while(ptr!=NULL){
				ptr=start;
				start=start->next;											//free all node in the linkedlist which stores details of "busdetails.txt"
				free(ptr);
				ptr=ptr->next;
			}	
	}while(n!=5);
	return 0;
}