موقع طلبة جامعة البحرين

يمكنك تصفح الموقع كزائر ولكن ندعوك لتسجيل عضوية خاصة بك لتحصل على كافة الصلاحيات مثل تنزيل ملفات المكتبة وقراءة تعليقات هيئة التدريس وغيرها. يمكنك الحصول على عضوية مجانية بالضغط على زر تسجيل. إذا قمت بالتسجيل مسبقا فيمكنك الضغط على زر دخول.

تسجيل دخول
  • قسم المكتبة الجامعية مغلق مؤقتا بعد الاستهداف التي تعرضت له بعض خدمات أمازون في البحرين، جاري استرجاع الملفات ونقلها إلى سيرفرات جديدة وسيتم بعدها اعادة افتتاح المكتبة

ITCS112 - ITCS104 - ITCS102 للفصل الصيفي 2014 - 2015

ها ياجماعه .. شعلوم الأمتحان ؟

:shiny:
 
كان سهل الحمدلله :)
 
PHP:
Using the following class definition of a Arraytype
 


class ArrayType
{
public:
    void print() const;      //Function to output the data stored in the array p.
    void insertAtEnd(int num);      //Function to insert num at the end array p
                void deleteelt(int num);      //Function to delete  num from the array p if exist
    int getsize();                //Function to return the size of  array p
                                                   bool isfull();      //Function to return true if size equal to 40;
   bool isEmpty();      //Function to return true if size equal to 0;
  int seqsearch(int num);  //Function to return the index of num or -1 if not found
  Arraytype();      //default Constructor initialize length=0
 


private:
    int length; 
    int p[40];     
};
 


1) Implement all member functions of the above class.
2) Complete the following main function to test all functions of your class:
int main()
{
    Arraytype L1;                     
    int num;                                     
    cout << " Enter 5 integers." << endl;  
    for (int i = 0; i < 5; i++)  {
        cin >> num;                              
        L1.insertAtEnd(num);             
    }
    cout<<"your array L1 is:";
    L1.print();                              
    cout << endl;                                  
     L1.insertAtEnd(34);                     
    cout<<"your new array L1 is:";
    L1.print(); 
……….
 


    return 0;                                    
}

ممكن مساعدتكم لو سمحتوووا ..
 
التعديل الأخير بواسطة المشرف:
Using the following class definition of a Arraytype



class ArrayType
{
public:
void print() const; //Function to output the data stored in the array p.
void insertAtEnd(int num); //Function to insert num at the end array p
void deleteelt(int num); //Function to delete num from the array p if exist
int getsize(); //Function to return the size of array p
bool isfull(); //Function to return true if size equal to 40;
bool isEmpty(); //Function to return true if size equal to 0;
int seqsearch(int num); //Function to return the index of num or -1 if not found
Arraytype(); //default Constructor initialize length=0



private:
int length;
int p[40];
};



1) Implement all member functions of the above class.
2) Complete the following main function to test all functions of your class:
int main()
{
Arraytype L1;
int num;
cout << " Enter 5 integers." << endl;
for (int i = 0; i < 5; i++) {
cin >> num;
L1.insertAtEnd(num);
}
cout<<"your array L1 is:";
L1.print();
cout << endl;
L1.insertAtEnd(34);
cout<<"your new array L1 is:";
L1.print();
……….



return 0;
}


ممكن مساعدتكم لو سمحتوووا ..:blushing:

الكلام مخربط فوق تحت هههههههه .. عدل او سو للسؤال برنت سكرين

بس يبين سهل اللهم اول 3 فنكشنز يبيلهم عشان تفهمهم

ترى كلهم ماخذينهم قبل مافيهم ولاشئ زياده
 
الكلام مخربط فوق تحت هههههههه .. عدل او سو للسؤال برنت سكرين

بس يبين سهل اللهم اول 3 فنكشنز يبيلهم عشان تفهمهم

ترى كلهم ماخذينهم قبل مافيهم ولاشئ زياده

تم التعديل (=
 
  • Like
التفاعلات: xrom
كود:
#include <iostream> 
#include <string> 
using namespace std; 
class ArrayType
{
private:
       int length; 
    int p[40];   
public:
      void print() const;   
void insertAtEnd(int num); 
 void deleteelt(int num); 
int getsize();   
 bool isfull();  
 bool isEmpty(); 
  int seqsearch(int num); 
    Arraytype();  
};
void printArraytype (int p[] , int lenght)
{
for (int i=0;i<size;i++)
cout<< arraytype.p[i]<<lenght;
}
void arrayType::insertAtend(int num)
{
      if(l==size)
      {cout<<"array full";
      }
      pos=i;
      for(int i=0,i<size,i++)
      { if{list[i]>=newelt)
      pos=i;
      break;
      }
      for(inti=size-1,i>=pos,i++)
            list[i+1]=list[i];
      list[pos]==newelt;
      size++;
      }
      void arrayTyoe::deleteelt(int num)
      {
            for(int i=pos+1,i<size,i++)
                  list[i-1]=list[i];
            size--;
      }
}
int arrayType::getsize()
{
      return size;
}
bool arrayType::isfull();
{
      if(p[i]==40)
            return true;
      else return false;
}
bool arrayType::isEmpty();
{
      if(p[i]==0)
            return true;
      else return false;
}
int arrayType:: seqsearch(int num)
{
      int loc=-1;
      for(int i=0,i<size,i++)
            if(p[i]==key)
            {loc=i;
      break;
      }
      return loc;
}
arrayType:: Arraytype( int); 
{
length=0;
}
int main()
{
    Arraytype L1;                     
    int num;                                     
    cout << " Enter 5 integers." << endl;  
    for (int i = 0; i < 5; i++)  {
        cin >> num;                              
        L1.insertAtEnd(num);             
    }
    cout<<"your array L1 is:";
    L1.print();                              
    cout << endl;                                  
     L1.insertAtEnd(34);                     
    cout<<"your new array L1 is:";
    L1.print();


هاااي اللي سسويته
 
كود:
#include <iostream> 
#include <string> 
using namespace std; 
class ArrayType
{
private:
       int length; 
    int p[40];   
public:
      void print() const;   
void insertAtEnd(int num); 
 void deleteelt(int num); 
int getsize();   
 bool isfull();  
 bool isEmpty(); 
  int seqsearch(int num); 
    Arraytype();  
};
void printArraytype (int p[] , int lenght)
{
for (int i=0;i<size;i++)
cout<< arraytype.p[i]<<lenght;
}
void arrayType::insertAtend(int num)
{
      if(l==size)
      {cout<<"array full";
      }
      pos=i;
      for(int i=0,i<size,i++)
      { if{list[i]>=newelt)
      pos=i;
      break;
      }
      for(inti=size-1,i>=pos,i++)
            list[i+1]=list[i];
      list[pos]==newelt;
      size++;
      }
      void arrayTyoe::deleteelt(int num)
      {
            for(int i=pos+1,i<size,i++)
                  list[i-1]=list[i];
            size--;
      }
}
int arrayType::getsize()
{
      return size;
}
bool arrayType::isfull();
{
      if(p[i]==40)
            return true;
      else return false;
}
bool arrayType::isEmpty();
{
      if(p[i]==0)
            return true;
      else return false;
}
int arrayType:: seqsearch(int num)
{
      int loc=-1;
      for(int i=0,i<size,i++)
            if(p[i]==key)
            {loc=i;
      break;
      }
      return loc;
}
arrayType:: Arraytype( int); 
{
length=0;
}
int main()
{
    Arraytype L1;                     
    int num;                                     
    cout << " Enter 5 integers." << endl;  
    for (int i = 0; i < 5; i++)  {
        cin >> num;                              
        L1.insertAtEnd(num);             
    }
    cout<<"your array L1 is:";
    L1.print();                              
    cout << endl;                                  
     L1.insertAtEnd(34);                     
    cout<<"your new array L1 is:";
    L1.print();


هاااي اللي سسويته

وين المشكله عندك؟
 
بليييز ساعدوني
 
PHP:
Using the following class definition of a Arraytype
 


class ArrayType
{
public:
    void print() const;      //Function to output the data stored in the array p.
    void insertAtEnd(int num);      //Function to insert num at the end array p
                void deleteelt(int num);      //Function to delete  num from the array p if exist
    int getsize();                //Function to return the size of  array p
                                                   bool isfull();      //Function to return true if size equal to 40;
   bool isEmpty();      //Function to return true if size equal to 0;
  int seqsearch(int num);  //Function to return the index of num or -1 if not found
  Arraytype();      //default Constructor initialize length=0
 


private:
    int length; 
    int p[40];     
};
 


1) Implement all member functions of the above class.
2) Complete the following main function to test all functions of your class:
int main()
{
    Arraytype L1;                     
    int num;                                     
    cout << " Enter 5 integers." << endl;  
    for (int i = 0; i < 5; i++)  {
        cin >> num;                              
        L1.insertAtEnd(num);             
    }
    cout<<"your array L1 is:";
    L1.print();                              
    cout << endl;                                  
     L1.insertAtEnd(34);                     
    cout<<"your new array L1 is:";
    L1.print(); 
……….
 


    return 0;                                    
}

ممكن مساعدتكم لو سمحتوووا ..

هذول جم فنكشن من المطلوبين قبل ما انام .. تفضل اخوي وسامحنا عالتقصير .. وحاول انت في الباقي + بدل الأسامي إلي انا حطيتها خلها مثل ما مكتوب في السؤال

insert item in the end of th array

PHP:
void insertanitem(int arr[],int&length,int item)
{
    for(int i=length ; i>length-1 ; i--)
        arr[i]=arr[i-1];

    length++;
    arr[length-1]=item;

}

Function shows the length - size of the array

PHP:
void arrsize(int arr[],int length)
{
    cout<<length;
    return;
}

Function to Delete an item if exist

PHP:
void deleteitem(int arr[],int&length,int item)
{
    for(int i=0 ; i<length ; i++)
    {
        if(arr[i]==item)
        {
            for(int j=i ; j<length-1 ; j++)
            arr[j]=arr[j+1];

        length--;
        i--;
        }
    }
}

Printing Function

PHP:
void print(int arr[],int&length)
{

    for(int i=0 ; i<length ; i++)
        cout<<arr[i]<<" ";

    cout<<endl;

}

Seq Seqrch

PHP:
int seqsearch(int arr[],int length,int key)
{

    for (int i=0 ; i<length ; i++)
    {
        if(arr[i]==key)
        {
            return i;
            break;
        }


        else
        return -1;

    }



}
 
هذول جم فنكشن من المطلوبين قبل ما انام .. تفضل اخوي وسامحنا عالتقصير .. وحاول انت في الباقي + بدل الأسامي إلي انا حطيتها خلها مثل ما مكتوب في السؤال

insert item in the end of th array

PHP:
void insertanitem(int arr[],int&length,int item)
{
    for(int i=length ; i>length-1 ; i--)
        arr[i]=arr[i-1];

    length++;
    arr[length-1]=item;

}

Function shows the length - size of the array

PHP:
void arrsize(int arr[],int length)
{
    cout<<length;
    return;
}

Function to Delete an item if exist

PHP:
void deleteitem(int arr[],int&length,int item)
{
    for(int i=0 ; i<length ; i++)
    {
        if(arr[i]==item)
        {
            for(int j=i ; j<length-1 ; j++)
            arr[j]=arr[j+1];

        length--;
        i--;
        }
    }
}

Printing Function

PHP:
void print(int arr[],int&length)
{

    for(int i=0 ; i<length ; i++)
        cout<<arr[i]<<" ";

    cout<<endl;

}

Seq Seqrch

PHP:
int seqsearch(int arr[],int length,int key)
{

    for (int i=0 ; i<length ; i++)
    {
        if(arr[i]==key)
        {
            return i;
            break;
        }


        else
        return -1;

    }



}

:RpS_blink:

معليك من الإجابه هذي .. يبيلها تعديل .. التعب ياخوك .. باجر ان شاء الله
 
ممكن أحد يشوفه ليي
مادري شنو المشكلة بالضبط كل شي مضبوط أعتقد
PHP:
# include<iostream>
# include<string>
using namespace std;
class BankAccont
{
private:
    long AccountNumber;
    string Name;
    float Balance;
public:
     BankAccont(long=999,string,float=0.0);
     void SetAccount(long, string, float);
     void getAccount(long &, string &, float &);
     void Withdeaw(float amount);
     void deposite(float amount);
     void displayAccontinfo();
};

BankAccont(long An, string N, float B)
{AccontNo=AN ; Name=N ; Balance=b;}

void BankAccount::SetAccount(long AccID, string NAME, float balance)
{
    AccountNumber=AccID;
    Name=NAME;
    Balance=balance;
}
void BankAccount::getAccount(long &AccID, string &NAME, float &balance)
{
    AccID=AccountNumber;
    NAME=Name;
    balance=Balance;
} 
void BankAccont::withdraw(float amount)
{
    if(Blance>=amount)
        Blance=Blance-amount;
}
void BankAccont::deposite(float amount)
{
    if(Blance>=amount)
        Blance=Blance+amount;
}
int main()
{
    float m,B;
    long AN , string AccontName;
    BankAccont myAccont(3/02/12,"ali",1000);
    cout << "Enter amount to be drawen:";
    cin >> m;
    myAccont.withdraw(m);
    myAccont.deopsite(300);
    myAccont.displayAccontinfo;
    BankAccont ITCS104Accont[50];
    for(int i=0 ; i<50 ;i++)
    {
        cin >> AN >> AccontName >> B;
        ITCS104Accont[i].setAccont(AN,AccontName,B);
        return 0;
    }
 
ههههه قصدك مليون خطأ فيه
تفضل ، اذا شفتك في الجامعه بكلمك عنه

PHP:
        # include<iostream>
        # include<string>
        using namespace std;
        class BankAccont
        {
        private:
            long AccountNumber;
            string Name;
            float Balance;
        public:
             BankAccont(long=999,string=" ",float=0.0);
             void SetAccount(long, string, float);
             void getAccount(long &, string &, float &);
             void Withdeaw(float amount);
             void deposite(float amount);
             void displayAccontinfo();
        };

       BankAccont :: BankAccont(long An, string N, float B)
        {AccountNumber=An ; Name=N ; Balance=B;}

        void BankAccont::SetAccount(long AccID, string NAME, float balance)
        {
            AccountNumber=AccID;
            Name=NAME;
            Balance=balance;
        }
        void BankAccont::getAccount(long &AccID, string &NAME, float &balance)
        {
            AccID=AccountNumber;
            NAME=Name;
            balance=Balance;
        } 
        void BankAccont::Withdeaw(float amount)
        {
            if(Balance>=amount)
                Balance=Balance-amount;
        }
        void BankAccont::deposite(float amount)
        {
            if(Balance>=amount)
                Balance=Balance+amount;
        }
        int main()
        {
            float m,B;
            long AN ;
            string AccontName;
            BankAccont myAccont(3/02/12,"ali",1000);
            cout << "Enter amount to be drawen:";
            cin >> m;
            myAccont.Withdeaw(m);
            myAccont.deposite(300);
           // myAccont.displayAccontinfo(); ( you don't write implementation )
            BankAccont ITCS104Accont[50];
            for(int i=0 ; i<50 ;i++)
            {
                cin >> AN >> AccontName >> B;
                ITCS104Accont[i].SetAccount(AN,AccontName,B);
                }
                system("pause");
                return 0;
            }

ملاحظه عدلت الكود على الاخطاء مادري اذا في شي غلط (كفكره) او شي ثاني مادري
 
ممكن الحل مال هدا
​
​
Write the definition of a class named BankAccount. The data members of the class BankAccount are: AccountNumber (long), Name (string), and Balance (float). In addition, the class BankAccount contains the following member functions:

​

  1. [*=left]Set function, Get function, for all members.
    [*=left]Withdraw function which is used to withdraw a certain amount X from the Account. It should check that the balance in the account is at least equal to X (i.e. X or more) before it allows the withdrawal and reduce the Balance by X.
    [*=left]Deposit which is used to Deposit a certain amount Y into the Account. It should of course increase the Balance by Y.
    [*=left]DisplayAccountDetails that prints (on the screen) all the information about the Account.

write a main program to do the following:&Oslash; Declare SavingBankAccount as an array of 5 of type BankAccount.&Oslash; Ask the user to enter the data of 5 accounts and set all members of SavingBankAccount.&Oslash; Deposit in each account of SavingBankAccounts 100BD.&Oslash; Withdraw from element 2 and 3 30BD.&Oslash; Display all accounts on screen.​
 
إذا ممكن احد يساعدني في هالاسامينت بليييز



Using the following class definition of a Arraytype

class ArrayType
{
public:
void print() const; //Function to output the data stored in the array p.
void insertAtEnd(int num); //Function to insert num at the end array p
void deleteelt(int num); //Function to delete num from the array p if exist
int getsize(); //Function to return the size of array p
bool isfull(); //Function to return true if size equal to 40;
bool isEmpty(); //Function to return true if size equal to 0;
int seqsearch(int num); //Function to return the index of num or -1 if not found
Arraytype(); //default Constructor initialize length=0

private:
int length;
int p[40];
};

1) Implement all member functions of the above class.
2) Complete the following main function to test all functions of your class:
int main()
{
Arraytype L1;
int num;
cout << " Enter 5 integers." << endl;
for (int i = 0; i < 5; i++) {
cin >> num;
L1.insertAtEnd(num);
}
cout<<"your array L1 is:";
L1.print();
cout << endl;
L1.insertAtEnd(34);
cout<<"your new array L1 is:";
L1.print();
……….

return 0;
}
 
^^
محاولاتش اختي ؟
وين المشكلة واجهتينها ؟ او شي مو فاهمته
 
اختي هذا الهوم اسايمت :)

بس صيرو اذكياه وغيروو كل شي :)

الفكرة وصلة

والكود وصل الى الدكتورة ( في طلاب يخبرون الذكاتره ) << عقول الاطفال للحين موجود :)

PHP:
#include<iostream>
#include <string>
using namespace std;

class ArrayType
{
public:
    void print() const;      //Function to output the data stored in the array p. //by ali sec9
    void insertAtEnd(int num);      //Function to insert num at the end array p 
    void deleteelt(int num);      //Function to delete  num from the array p if exist 
    int getsize();                //Function to return the size of  array p
    bool isfull();      //Function to return true if size equal to 40; 
    bool isEmpty();      //Function to return true if size equal to 0; 
    int seqsearch(int num);  //Function to return the index of num or -1 if not found
    ArrayType(){length=0;};      //default Constructor initialize length=0 

private:
    int length;  
    int p[40];      
};

int ArrayType::seqsearch(int num)
{
    for (int i=0; i<length;i++)
        if (p[i]==num)
            return i;
    return -1;
}
void ArrayType::insertAtEnd(int num){
    
        p[length]=num;
        length++;
} 

void ArrayType::deleteelt(int num){
for(int i=0; i<length ; i++)
{
if(p[i] == num)
{
for (int j = i; j < length; ++j)
    p[j] = p[j + 1];
length--;
}
} 
} 
void ArrayType::print()const
    {
       for (int i = 0; i < length; i++)
           cout<<p[i];
    }
int ArrayType::getsize(){
    return length;}
bool ArrayType::isfull(){
    if(getsize()==40)return true;
    return false;
}
bool ArrayType::isEmpty(){
    if(getsize()==0)return true;
    return false;
}

int main()
{
    ArrayType L1;                      
    int num;                                      
    cout << " Enter 5 integers." << endl;   
    for (int i = 0; i < 5; i++)  {
        cin >> num;                               
        L1.insertAtEnd(num);              
    }
    cout<<"\n\n Your array L1 is:";
    L1.print();                               
    cout << endl;                                  
     L1.insertAtEnd(34);
         L1.deleteelt(5);
     cout<<"\n\n Your new array L1 is:";
    L1.print(); 



    cout <<"\n\n\n\n Your array L1 is:";
    if(L1.isfull()){
        cout<<"FUll\n";};
    if(L1.isEmpty()){
        cout<<"EMPTY\n";};


    return 0;                                     
}

اذا في اخطاء انا اعتذر
الا اكتشف اي خطا يخبرنا
 
شلون اضيف هالقانون في الكلاس
time r=area r/3 + circumference r/2

انه سويت هلوت
int calculate time ();
بس عقب ماعرف ضروري اللحين بغيته
 
2epkart.png


هذا سؤال اللاب مال اليوم، سويته ع السريع لكن اعتقد حلي خطأ لأن يمكن كنت اقدر استخدم باقي الـfunctions مال الكلاس بس ما استخدمتهم!؟
السؤال ما كان واضح صراحة، وحتى الدكتورة ما وضحت شي، كان عبارة عن كويز لأن احنا متأخرين شوي
المهم هذا حلي وإذا فيه ملاحظات او طريقة ثانية للحل اسهل خبروني
​

PHP:
#include <iostream>
using namespace std;

const double PI=3.141592;
class sparePart{
private:
        double radius;
        double cost;
        double circumference;
        double time;
        double area;
public:
        void set(double, double, double, double, double);
        void get(double &, double &, double &, double &, double &) const;
        void print();
        sparePart();
        ~sparePart();
        void ProcessTime();
        void Cost();
};

void sparePart::set(double RADIUS, double CIRCUM, double COST, double TIME, double AREA)
{
        radius=RADIUS;
        cost=COST;
        circumference=CIRCUM;
        time=TIME;
        area=AREA;
}
void sparePart::get(double &RADIUS, double &CIRCUM, double &COST, double &TIME, double &AREA) const
{
        COST=cost;
        CIRCUM=circumference;
        RADIUS=radius;
        TIME=time;
        AREA=area;
}
void sparePart::print(){
        cout<<"Cost: "<<cost<<endl
                <<"Circumference: "<<circumference<<endl
                <<"Radius: "<<radius<<endl
                <<"Time: "<<time<<" hours."<<endl
                <<"Area: "<<area<<endl;
}
sparePart::sparePart(){
        cost=0.0;
        circumference=0.0;
        radius=0.0;
        time=0.0;
        area=0.0;
}
sparePart::~sparePart()
{
        cout<<"Object deleted."<<endl;
}
void sparePart::ProcessTime()
{
        time= (area/3) + (circumference/2);
}
void sparePart::Cost()
{
        cost= 3.2 * time;
}
int main()
{
        sparePart Part[10];
        double COST=0.0, CIRCUM=0.0, RADIUS=0.0, TIME=0.0, AREA=0.0, SUMc=0.0, SUMt=0.0;
        double gCOST=0.0, gCIRCUM=0.0, gRADIUS=0.0, gTIME=0.0, gAREA=0.0;

        cout<<"Enter the info of area & circumference of 10 spare parts: "<<endl;
        for(int i=0; i<10; i++)
        {
                cout<<"Spare #"<<i+1<<" area: ";
                cin>>AREA;
                cout<<"Spare #"<<i+1<<" circumference: ";
                cin>>CIRCUM;
                cout<<endl;

                RADIUS=AREA/PI;
                Part[i].set(RADIUS, CIRCUM, COST, TIME, AREA);
                Part[i].ProcessTime();
                Part[i].Cost();
                Part[i].get(gRADIUS, gCIRCUM, gCOST, gTIME, gAREA);
                SUMt += gTIME;
                SUMc += gCOST;
        }
        cout<<"The process time is: "<<SUMt<<" hours."<<endl
                <<"The cost is: "<<SUMc<<"."<<endl;

        system("pause");
        return 0;
}
 
اختي هذا الهوم اسايمت :)
بس صيرو اذكياه وغيروو كل شي :)
الفكرة وصلة
والكود وصل الى الدكتورة ( في طلاب يخبرون الذكاتره ) << عقول الاطفال للحين موجود :)


صح ، و من جدي انا قلت لها عطيني محاولتش عشان اول شي تستفيد وثاني شي اكمل عليها ويكون كود جديد
مع ان اوردي انا جاوبته كامل قبل يومين اعتقد بس كان خاص لاحد الاعضاء مايصير اخليه هني :smile:
احتمال في ناس تسوي كوبي وبست وقد يكونون معاها في سكشن
المهم انتبهوا .. واعتذر على التقصير


ماجيكت انا حالياً الكود هذا ، بعدين بشوفه
 
التعديل الأخير:
عودة
أعلى أسفل