niedziela, 11 listopada 2018

The queue and data about the exe file (C++ Builder)



template <class temp_Value> class t_Queue
{
 private:
int start,end,max_Value;
temp_Value *class_Value;
 public:
   t_Queue(int i)
   {
  start=0;
  end=0;
  max_Value=i;
  class_Value=new temp_Value[max_Value+1];
   }

   bool is_Empty()
   {
  bool b_value;
  if(start==end)
b_value=true;
  else
b_value=false;
  return b_value;

   }
   bool make_Op(temp_Value &make_Value)
   {
  if(start==end)
return false;
  make_Value=class_Value[start++];
  if(start>max_Value)
start=0;
  return true;
   }
   void insert_Q(temp_Value i)
   {
  class_Value[end++]=i;
  if(end>max_Value)
        end=0;
   }
};

void __fastcall TForm1::Button1Click(TObject *Sender)
{
 int i;
 bool j;
 UnicodeString info_Exe[5];
 UnicodeString info_Text[5];
 UnicodeString temp_Name;
 UnicodeString text_Value;

 temp_Name=Application->ExeName;
 info_Exe[0]=ExtractFileName(temp_Name);
 info_Exe[1]=ExtractFileDir(temp_Name);
 info_Exe[2]=ExtractFileDrive(temp_Name);
 info_Exe[3]=ExtractFileExt(temp_Name);
 info_Exe[4]=ExtractRelativePath(GetCurrentDir(),temp_Name);
 info_Text[0]="File Name: ";
 info_Text[1]="Directory: ";
 info_Text[2]="Drive: ";
 info_Text[3]="Extension File: ";
 info_Text[4]="Path: ";
 t_Queue<UnicodeString> text_Queue(5),info_Queue(5);
 for(i=0;i<5;i++)
 {
text_Queue.insert_Q(info_Text[i]);
info_Queue.insert_Q(info_Exe[i]);
 }
 for(i=0;i<6;i++)
 {
   j=text_Queue.make_Op(temp_Name);
   if(j)
ListBox1->Items->Add(temp_Name);
   else
ListBox1->Items->Add("Queue is empty!");
 }
 for(i=0;i<6;i++)
 {
   j=info_Queue.make_Op(temp_Name);
   if(j)
ListBox2->Items->Add(temp_Name);
   else
    ListBox2->Items->Add("Queue is empty!");
 }
}

Brak komentarzy:

Prześlij komentarz