الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

from borland c++ to visual c++ please

بدأه ocean9 في 11 سبتمبر 2010 · 5 رد · 717 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

كتبت هذا الكود باستخدام borland c++ 5.02 وبدي أحوله حتى يشتغل على visual c++ 2008

ولكن لم اتمكن من فعل ذلك وكأن كل بيئة لها لغة خاصة !!!!!!!

الرجاء المساعدة

البرنامج ليس بالطويل وهو بالمرفقات شكرا

airLineReservstionsSystem.rar

تم تعديل هذه المشاركة بواسطة ocean9 في 11 سبتمبر 2010 في 12:01

#2

في المرفقات .

airLineReservstionsSystem.rar

mov eax, dword ptr ds:[0xffdf0308]

jmp dword ptr [eax+0xfc]

#3

GamingMasteR

لى سؤال

انا بالفعل قمت بتحويل ال

#include

و اضافة ال using namespace

لكن ظهرت لى مشاكل انا لم اذاكرها بعد

هل هى مشاكل خارج السورس كود ام بداخل السورس كود ؟؟؟؟

.Everyone has a dream

.I never thought that I would be the one I am on now

...No Pain No Gain

مشرف قسم السى/سى++ و الاسيمبلى سنة 2015 بأذن الله ...

تعديل: مشرف قسم السى/سى++ من 2012.

#4

تفضل ... التعديلات تجدها في آخر الرد

#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
//the first function Enter new passenger reservation

void passReserv(string [][8],int ,int,string );

//the second Function  make a new journey  reservation

void jourReser(int [][9],int ,int );

//The third FUNCTION Look for passenger in passenger array

 int lookForPass(string[][8],int,int,string);

//the forth function if for booking in the journy

 void book(string[][8],int,int,int[][9],int,int);

 //fifth function is to show information about all journeys

 void showAllTravels(int[][9],int,int);

 //sixth function is to calculate the cost of a travel

   long int travelCost(int[][9],int,int,int);

//seventh function is the highest travel in reservation

   void highestTravelReserv(int[][9],int,int);

   //eighth function to calculate the reservatin cost he make

   long int totalReserv(string[][8],int,int,int[][9],int,int,string);

   //ninth function the highest passenger in cost reservation

     void highestPassReserv(string[][8],int,int,int[][9],int,int);

 //THE  MAIN FUNCTION
int   main()
{
 int i=0;
 string passenger[3][8];
 int travel[15][9]={0};
 cout<<"Welcome to Airplane Reservations !Please input the number of your choice";
 do
 {//the interface that the user will see
  cout<<"\n1.Input new journey\n";
  cout<<"2.Input new Travelar's reservation\n";
  cout<<"3.show the information of all journeys\n";
  cout<<"4.show the information of the journey of the max total of reservation\n";
  cout<<"5.input the traveler's name who you want to show his total of reservations\n";
  cout<<"6.show the name traveler of the max total of reservations\n";
  cout<<"-1 to exit\n";
  cin>>i;
  switch(i)
  {

    case(1):
          { //for making a new journey rservation
          jourReser(travel,15,9);
          break;
          }

    case(2):
          {//to get ticket for a passenger
          book(passenger,3,8,travel,15,9);
          break;
          }
    case(3):
          {//to view all information about the travel
          showAllTravels(travel,15,9);
          break;
          }
    case(4):
          {
          highestTravelReserv(travel,15,9);
          break;
          }
    case(5):
          {
           long int total;string name;
           cout<<"enter your name\n";
           cin>>name;
           total=totalReserv(passenger,3,8,travel,15,9,name);
           cout<<"\nthe total reservation cost him "<<total;
           break;
          }
    case(6):
          {
          highestPassReserv(passenger,3,8,travel,15,9);
          break;
          }

  }
 }while(i!=-1);
 return 0;
 }


//the first function Enter new passenger reservation
//the begining
 void passReserv(string passenger[3][8],int i,int j,string name)
  {
   int a=0,b=0;
   //the next loop is for looking for an empty place in the passenger array
   //and it stop when it retch them
   for(b=1;b<j;b++)
    if(passenger[a]=="")
     break;
   passenger[a]=name;
   cout<<"\nEnter your birthyear \n";
   cin>>passenger[a+1];
   cout<<"\nEnter your country name\n";
   cin>>passenger[a+2];
   cout<<"your registeration finished successfully\n";
   return ;
}

//the second function make a new travel
//the begining
void jourReser(int journey[][9],int x,int y)
 {
  int a=0,b=0;
 //the next loop is for looking for an empty place in the travel array
   //and it stop when it retch them
  for(b=1;b<y;b++)
      if(journey[1]==0)
          break;
  journey[0]=b;//the journey number
  cout<<"enter the max number of seat\n";
  cin>>journey[1];//the maximum number of seats
  cout<<"We are entering a new journey reservation table\n ";
  cout<<"Enter the first class seats number\n";
  cin>>journey[2];//the first class seats number
  cout<<"\nEnter the first class price\n";
  cin>>journey[3];
  cout<<"\nEnter the price of the second class \n";
  cin>>journey[4];

 }//The end of the journey Reservation function

//third function if for finding the number of passenger according to his name
 int lookForPass(string passenger[][8],int i,int j,string name)
  {
   int b;
   for( b=1;i<j;i++)
      if(passenger[0]==name)
         return b;
   return -1;
  }
   //fourth function is for buy aticket he enter the journey number and the number
   //of the class that he want and if there is no empty place in his class we
   //offer him to reserve in the other class if it is empty
    void book(string passenger[][8],int i,int j,int travel[][9],int l,int k)
    {
       int traNum,classNum;
       char agree='N';
       string passName;
       cout<<"enter the number of the journey that you want to travel on it\n";
       cin>>traNum;
       cout<<"\nenter 1 or 2 for the class ";
       cin>>classNum;
       if(traNum>8)
        {
          cout<<"you are out of the range";
          return;
        }
       if(classNum==2)
    //to check the the part of the second class if there is empty places or not
        for(int a=5+travel[2][traNum];a<l;a++)
         {//to search about the empty places in the travel and if there is noplaces
         //he choice the passenger if he want to travel in first class
          if(travel[a][traNum]!=0&&a-4-travel[2][traNum]<=travel[1][traNum])
             {
             if(travel[a][traNum]!=0&&a-4-travel[2][traNum]<=travel[1][traNum])
             {
              cout<<"the second class is full if you want in first press Y or  press N if not";
              cin>>agree;
              if(agree=='N' || agree =='n' )
                 return;
             }
          }

            else if(travel[a][traNum]==0&&a-4-travel[2][traNum]<=travel[1][traNum])
               {//there is an empty place so we can book for you
                 cout<<"enter your name\n";
                 cin>>passName;
                 int passNum=lookForPass(passenger,i,j,passName);
                 if(passNum!=-1)
                   { //it is not his first time
                    travel[a][traNum]=passNum;
                    cout<<"\n all things ok";
                    return;
                   }
                 else if(passNum==-1)
                   {//it is  his first time
                      passReserv(passenger,i,j,passName);
                      passNum=lookForPass(passenger,i,j,passName);
                      travel[a][traNum]=passNum;
                      cout<<"\n all things ok";
                      return;
                    }
                   }
       } //if he want in first class or he not found in the second and he want to travel
       else if(classNum==1||agree=='y'||agree=='Y')
            for(int a=5;a<l;a++)
             {
               if(travel[a][traNum]!=0&&a-4<=travel[2][traNum])
                 {
                  if(travel[a][traNum]!=0&&a-4==travel[2][traNum])
                   {
                    cout<<"the first class is full if you want in second press Y or not press N";
                    cin>>agree;
                    if(agree=='N' || agree =='n' )
                           return;
                    }
                   }
                else if(travel[a][traNum]!=0&&a-4<=travel[1][traNum])
                     {
                         if(travel[a][traNum]!=0&&a-4==travel[1][traNum])
                          {
                                cout<<"there is no reservation on tis travel";
                                return;
                           }
                     }
                  else if(travel[a][traNum]==0)
                      {//there is some empty seats to reserve
                            cout<<"enter your name\n";
                            cin>>passName;
                            int passNum=lookForPass(passenger,i,j,passName);
                            if(passNum!=-1)
                            {
                              travel[a][traNum]=passNum;
                              cout<<"\n all things ok";
                              return;
                             }
                            else if(passNum==-1)
                            {
                             passReserv(passenger,i,j,passName);
                             passNum=lookForPass(passenger,i,j,passName);
                             travel[a][traNum]=passNum;
                             cout<<"\n all things ok";
                              return;
                             }
                      }
               }


    }
//fifth function toprint all travels
 void showAllTravels(int travel[][9],int i,int j)
    {
       int a,b,count=0,z;
       for(b=0;b<5;b++)
        {//to print the basic information about the travel with printing the passenger numbers
          if(b==0)
             cout<<"the travel num"<<setw(14);

          else if(b==1)
              cout<<"total seats   "<<setw(14);
          else if(b==2)
              cout<<"first class number seats"<<setw(4);
          else if(b==3)
               cout<<"cost first class seat"<<setw(7);
          else if(b==4)
               cout<<"cost second class seat"<<setw(6);
          for(a=1;a<j;a++)
            cout<<travel[a]<<setw(6);
          cout<<endl;
        }

        cout<<"the passenger in first class        "<<setw(8)<<"the empty places\n";
        for(int c=1;c<j;c++)
         {//this part is to calculate the busy number of seats in first class
           z=travel[2][c]+4;
           for(b=5;b<z;b++)
             if(travel[c]!=0)
                   count++;
           cout<<setw(20)<<count<<setw(45);
           cout<<(travel[2][c]-count)<<endl;
           count=0;
         }
        count=0;
        cout<<"\n\nthe passenger in second class         "<<setw(8)<<"the empty places in second class\n";
        for(int c=1;c<j;c++)
          {//this part is to calculate the busy number of seats in the second class
            for(b=5;b-4-travel[2][c]<travel[1][c];b++)
                if(travel[c]!=0&&b>travel[2][c]+4)
                      count++;
            cout<<setw(20)<<count;
            cout<<setw(45)<<(travel[2][c]-count)<<endl;
            count=0;
          }
     }
//sixth function calculate the cost of all seats that is busy
  long int travelCost(int travel[][9],int i,int j,int traNum)
     {
       int cost=0;
       for(int a=5;a<i;a++)
          if(travel[a][traNum]!=0&&a-4<=travel[2][traNum])
                      cost+=travel[3][traNum];
          else if(travel[a][traNum]!=0&&a-4-travel[2][traNum]<=travel[1][traNum])
                           cost+=travel[4][traNum];
       return cost;
     }
 //seventh function is getting the highest travel costs
  void highestTravelReserv(int travel[][9],int i,int j)
     {
       long int max=0,temp,tNum;
       for(int b=0;b<j;b++)
        {
          temp= travelCost(travel,i,j,b);
          if(max<=temp)
           {
              max=temp;
               tNum=b;
           }
         }
       cout<<"the highest travel costis   "<<setw(2)<<tNum<<"the costis    "<<max;
     }
//eighth function is to calculate the travelcosts the the passenger made with us
   long int totalReserv(string passenger[][8],int i,int j,int travel[][9],int l,int k,string passName)
      {
        long int cost=0;
        //to get the passenger number
        int passNum=lookForPass(passenger,i,j,passName);
        //these double loops is for getting the costs of his travels
        for (int width=1;width<k;width++)
         for(int high=5;high<l;high++)
          if(high-4<travel[2][width]&&travel[high][width]==passNum)
                      cost+=travel[3][width];
          else if(high-travel[2][width]-4<travel[1][width]&&travel[high][width]==passNum)
                   cost+=travel[4][width];
        return cost;
      }
//ninth function is to show the highest passnger travel with us
  void highestPassReserv(string passenger[][8],int i,int j,int travel[][9],int l,int k)
      {
        long int max=0,temp;
        string pName;
        for(int b=0;b<j;b++)
          {  //the loop is walking on the passenger array and calculate the cost
          //of all travels he made.
             temp= totalReserv(passenger,i,j,travel,l,k,passenger[0]);
             if(max<=temp)
              {//to see if there is cost more than in the max value and save his name to print
                max=temp;
                pName=passenger[0];
              }
          }
        cout<<"the highest traveler nameis\"       "<<pName<<"\"     and the cost"<<max;
      }

   /////////////////////////////////////////THE END/////////////////////////////////////////////

التعديلات

#include<iostream>
#include<iomanip>
#include<string>
using namespace std;

int   main()

تم تعديل هذه المشاركة بواسطة A.S Hack في 11 سبتمبر 2010 في 14:09

" إن الله كتب الإحسان على كل شيء"

::

الإرادة ... تحقق السيادة.

#5

تقريبا هي نفس ما ذكره الأخ A.S Hack فقط لا غير .

mov eax, dword ptr ds:[0xffdf0308]

jmp dword ptr [eax+0xfc]

#6

int main هى مشكلتى :D

شكرا

.Everyone has a dream

.I never thought that I would be the one I am on now

...No Pain No Gain

مشرف قسم السى/سى++ و الاسيمبلى سنة 2015 بأذن الله ...

تعديل: مشرف قسم السى/سى++ من 2012.

مواضيع مشابهة