コード例 #1
0
ファイル: XIIPROJE.CPP プロジェクト: vigzmv/Tours-and-Travels
void entry_menu()
{
  int ch,num;
  clrscr();
  cout<<"\n\n\n\t\tENTRY MENU";
  cout<<"\n\n\t1.CREATE STUDENT RECORD";
  cout<<"\n\n\t2.DISPLAY ALL STUDENTS RECORD";
  cout<<"\n\n\t3.SEARCH STUDENT RECORD";
  cout<<"\n\n\t4.MODIFY STUDENT RECORD ";
  cout<<"\n\n\t5.DELETE STUDENT RECORD ";
  cout<<"\n\n\t6.RETURN TO MAIN MENU";
  cout<<"\n\nPlease Enter Your Choice(1-6).......";
  cin>>ch;
  clrscr();
  switch(ch)
  {
	  case 1:write_record();break;
	  case 2:read_record();break;
	  case 3:cout<<"\n\n\tPlease enter the roll no. of student ";
		 cin>>num;
		 display(num);
		 break;
	  case 4:cout<<"\n\n\tPlease enter the roll no. of student ";
		 cin>>num;
		 modify_record(num);
		 break;
	  case 5:cout<<"\n\n\tPlease enter the roll no. of student ";
		 cin>>num;
	    delete_record(num);
		 break;
     case 6:break;
     default : cout<<"\a";entry_menu();
  }
}
コード例 #2
0
ファイル: Hotel.CPP プロジェクト: akreddysoft/CollegeCode
void food :: modify_item(void)
{
	clrscr() ;
	char t_code[5], ch ;
	int t, tcode ;
	gotoxy(3,25) ;
	cout <<"Press <ENTER> to see the list" ;
	gotoxy(5,3) ;
	cout <<"Enter Item Code of the item to be Modify : " ;
	gets(t_code) ;
	t = atoi(t_code) ;
	tcode = t ;
	if (t_code[0] == '0')
		return ;
	if (tcode == 0)
	{
		list_of_item() ;
		gotoxy(1,25) ; clreol() ;
		gotoxy(3,25) ;
		cout <<"Press <ENTER> to Exit" ;
		gotoxy(5,24) ;
		cout <<"Enter Item Code of the item to be modify : " ;
		gets(t_code) ;
		t = atoi(t_code) ;
		tcode = t ;
		if (tcode == 0)
			return ;
	}
	clrscr() ;
	if (!item_found(tcode))
	{
		gotoxy(5,5) ;
		cout <<"\7Record not found" ;
		getch() ;
		return ;
	}
	display_record(tcode) ;
	do
	{
		gotoxy(5,8) ;
		cout <<"Do you want to Modify this record (y/n) : " ;
		ch = getche() ;
		ch = toupper(ch) ;
	} while (ch != 'N' && ch != 'Y') ;
	if (ch == 'N')
		return ;
	modify_record(tcode) ;
}
コード例 #3
0
/**
 * Signature of a function that is called whenever the DNS service
 * encounters a DNS request and needs to do something with it.  The
 * function has then the chance to generate or modify the response by
 * calling one of the three "GNUNET_DNS_request_*" continuations.
 *
 * When a request is intercepted, this function is called first to
 * give the client a chance to do the complete address resolution;
 * "rdata" will be NULL for this first call for a DNS request, unless
 * some other client has already filled in a response.
 *
 * If multiple clients exist, all of them are called before the global
 * DNS.  The global DNS is only called if all of the clients'
 * functions call GNUNET_DNS_request_forward.  Functions that call
 * GNUNET_DNS_request_forward will be called again before a final
 * response is returned to the application.  If any of the clients'
 * functions call GNUNET_DNS_request_drop, the response is dropped.
 *
 * @param cls closure
 * @param rh request handle to user for reply
 * @param request_length number of bytes in request
 * @param request udp payload of the DNS request
 */
static void 
modify_request (void *cls,
		struct GNUNET_DNS_RequestHandle *rh,
		size_t request_length,
		const char *request)
{
  struct GNUNET_DNSPARSER_Packet *p;
  unsigned int i;
  char *buf;
  size_t len;
  int ret;

  p = GNUNET_DNSPARSER_parse (request, request_length);
  if (NULL == p)
  {
    fprintf (stderr, "Received malformed DNS packet, leaving it untouched\n");
    GNUNET_DNS_request_forward (rh);
    return;
  }
  for (i=0;i<p->num_answers;i++)
    modify_record (&p->answers[i]);
  buf = NULL;
  ret = GNUNET_DNSPARSER_pack (p, 1024, &buf, &len);
  GNUNET_DNSPARSER_free_packet (p);
  if (GNUNET_OK != ret)
  {
    if (GNUNET_NO == ret)
      fprintf (stderr, 
	       "Modified DNS response did not fit, keeping old response\n");
    else
      GNUNET_break (0); /* our modifications should have been sane! */
    GNUNET_DNS_request_forward (rh);
  }
  else
  {
    if (verbosity > 0)
      fprintf (stdout,
	       "Injecting modified DNS response\n");
    GNUNET_DNS_request_answer (rh, len, buf);
  }
  GNUNET_free_non_null (buf);      
}