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

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

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

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

السلام عليكم شعب


تفضلو هذا الاسايمنت 9 من الاب


وسامحوني على الاختصارات و الاغلاط

اي احد يشوف غلط يخبرنا

:nosweat: عدلوه قبل رفعه للبلاك بورد عاد

لانه ناقص cout
PHP:
#include<iostream>
using namespace std;

class Table {
private:
int NRS;
int NCS;
double **Mat;

public:
Table(int=10,int=10); 
Table(const Table& m);
void inputTable();
void printTable();
void swapRows(int,int);
~Table();

};


Table::Table(int a, int b){
    NRS=a;
    NCS=b;
    Mat = new  double *[NRS];
for(int i=0;i<NRS;++i)
    {
    Mat[i] = new double[NCS];
    
    for(int j=0;j<NCS;j++){
       Mat[i][j] = 0;
       }

    }
}

Table::~Table(){
    for(int i=0;i<NCS;i++)
    delete [] Mat[i];
    delete [] Mat;
}

Table::Table(const Table &m)
{
    NCS=m.NCS;
    NRS=m.NRS;
    
    Mat = new  double *[NRS];
for(int i=0;i<NRS;++i)
    {
    Mat[i] = new double[NCS];
    
    for(int b=0;b<NCS;b++){
       Mat[i][b] = m.Mat[i][b];
       }

    }
}

void Table::printTable(){
    for(int i=0;i<NRS;i++){
        cout<<"\n";
        for(int b=0;b<NCS;b++)
            cout<< Mat[i][b]<< "\t";

    }
cout<<endl;
}

void Table::swapRows(int I,int J){
    double temp;
for(int i=0;i<NRS;i++){
    temp = Mat[J][i];
    Mat[J][i] = Mat[I][i];
    Mat[I][i] = temp;
    }
}

void Table::inputTable(){
    for(int i=0;i<NRS;i++){
        for(int j=0;j<NCS;j++)
            cin>>Mat[i][j];
        
        }
}

void main()
{
    Table Mat1(5,5);

    Mat1.inputTable();

    Table Mat2(Mat1);

    Mat2.swapRows(1,3);
cout << "Mat1 :"<<endl;
    Mat1.printTable();
cout << "Mat2 :"<<endl;
    Mat2.printTable();
}

ادعو لينا
 
مشكور اخوي رحم الله والديك
ههههه جان زين ماسويته ، توي برفعه باقي عليه function وحده

بالتوفيق
 
مشكور خوك رحم والديك انقذنتا والله :RpS_crying:

ابوس راسك لو اشوفك :bleh:
 
الاساينمنت 9 وايد فيها اغلاط
 
لا اوردي انا ماعندي هالأسايمنت
بس قصدي ان كنت اجاوبه عشان اخليه هني
 
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
اذا تقدرون تجوفون لينا حل هالسؤال بعد واكون شاكر ليكم


تفضل اخوويي

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;                                     
}
 
تسلم يالغالي وما تقصر
في ميزان حسناتك ان شاء الله
يا رب يعطيك الصحة والعافية
 
مشكوووور خوك على حل اﻻسايمنت ما تقصر نخدمك في اﻻفراح ان شاء الله:blush-anim-cl:
 
اللاب اسايمنت مال اليوم :)

في الخطأ في السوال على حد اعتقادي

تكرار عملية +
بس انا ما عدلتها علشان تقراونه كامل ههه

ونكرر ونقول \\ لا اتحمل مسؤالية الاخطاء

ولا تقعدون تسبوني لين فيه غلط , للحين ما تصحح الاسايمنت :)

دعواتم


PHP:
Ch15   Overloading 
A complex number is a number that can be put in the form a + bi, where a and b are real numbers and i is called the imaginary unit, where i2 = −1. In this expression, a is called the real part and b the imaginary part of the complex number. Addition  of two complex numbers  is  The multiplication of two complex numbers is:  Add to the class Complex two functions that overload the operators + as a member and * as a non member.
PHP:
# include <iostream>
using namespace std;

class Complex {
private:
    int a;
    int b;

public:
    Complex();   
    Complex(int,int); 
    void print() const;
    
    Complex operator +(const Complex & ) const;
    friend Complex operator *(const Complex &, const Complex & );
};

  Complex::Complex()  {  a = 0;  b = 1;    } 
  Complex::Complex(int newNum, int newDen)  {  a=newNum;  b=newDen; }
void Complex::print() const  {     cout<< a <<"+"<< b<<"i";  }

Complex Complex:: operator +(const Complex & Z )const
{
     Complex temp;
     temp.a= a+Z.a;
     temp.b= b+Z.b;
     return temp;

}

Complex operator *(const Complex &  Z , const Complex & X) 
{
    Complex tmp;
     tmp.a=Z.a * X.a;
     tmp.b=Z.b * X.b;
     return tmp;
}

int main(){
    Complex f1(9,8); 
    Complex f2(2,3); 
    Complex result;  
    result=f1 + f2;

cout << "The COMPLEX Addition  of ";
    f1.print();
    cout << " and  ";
    f2.print();
    cout << " is "; 
    result.print();
    cout << endl;
  result=f1 * f2;  
cout << "The COMPLEX Multiplication  of ";
      result=f1 + f2;
  f1.print();
    cout << " and  ";
    f2.print();
    cout << " is "; 
    result.print();
    cout << endl;

}
 
stupid question:nosweat:
في فرق بين الـErrors و الـWarnings ؟
>> أقصد الـwarning يكون نفس حال الايرور في البروقرام؟
و اذا الآوت بوت يطلع صح و في warning واحد ننقص درجات!؟:mellow:
​
 
stupid question:nosweat:
في فرق بين الـErrors و الـWarnings ؟
>> أقصد الـwarning يكون نفس حال الايرور في البروقرام؟
و اذا الآوت بوت يطلع صح و في warning واحد ننقص درجات!؟:mellow:
​
الError خطأ ما يشتغل البرنامج بسببه
الـWarning مجرد تنبيه، مثلاً ارقام double راح يتحولون لـinteger في هالحالة بيطلع لج تنبيه يقول أنه احتمال يكون في خسارة بالقيمة النهائية او بما معناه.
 
  • Like
التفاعلات: FHJ
الError خطأ ما يشتغل البرنامج بسببه
الـWarning مجرد تنبيه، مثلاً ارقام double راح يتحولون لـinteger في هالحالة بيطلع لج تنبيه يقول أنه احتمال يكون في خسارة بالقيمة النهائية او بما معناه.

يعني المهم ان الـwarning ما ينحسب كخطأ في البروقرام:nosweat:

شكككراً
​
 
بلييييز ساعدوني ف حل هالاسايمنت


PART(A)

Implement a class named bookList which includes the followingdata members:

- list: a pointer to string, representing a dynamic array to holdthe titles of books.

- size: maximum number of books in the array.

- count: the number of books currently in thearray.

The class should includethe following member functions:

• AConstructor with default valueparameter for size=10. The function should initialize count to be zero andcreate a dynamic array pointed by list.

• Acopy constructor.

• Afunction named printList to printall the information.

• Afunction named addNewBook which isused to add a new item Y to the beginning of the list and increment count. The function should check first that list is not full and Y is not already in the list.

• ADestructor.

PART(B)



Write a main function totest your class.




Assignment # 5)


PART(A)

Implement a class named shoppingList which includes thefollowing data members:

- list: a pointer to string, representing a dynamic array to holdthe names of the shopping items.

- maxSize: maximum number of items in the shopping list.

- numItems: the number of items currently in thelist.

The class shoppingList contains the followingmember functions:

• AConstructor with default valueparameter for maxSize=10. The function should initialize numItems to be zero andcreate a dynamic array pointed by list of size maxSize.

• Acopy constructor.

• Afunction named printList to printall the information about shoppingList.

• Afunction named addNewItem which isused to add a new item Y to the end of the list andincrement numItems. The functionshould check first that list is not full and Y is not already in the list.

• Afunction named isListEmpty whichreturns true if list is empty.

• Afunction named isListFull whichreturns true if list is full.

• ADestructor.

PART(B)

In the main function,write C++ statements to:

• Createan object names myList1 of typeshoppinglist with size=5;

• Add“Rice” and “Sugar” items to list1.

• Createanother object named myList2 andinitialize it by using the value of myList1.

• Add“Milk” and “Coffee” to myList2.

• Printthe details of myList1 and myList2.
​
 
امم .. اللي مع د. أمل ..
ممكن نوت آخر محاضرتين ..
أو لوين وصلت في الشرح ؟

:RpS_unsure:


​
 
بلييييز ساعدوني ف حل هالاسايمنت

PART(A)

Implement a class named bookList which includes the followingdata members:

- list: a pointer to string, representing a dynamic array to holdthe titles of books.

- size: maximum number of books in the array.

- count: the number of books currently in thearray.

The class should includethe following member functions:

• AConstructor with default valueparameter for size=10. The function should initialize count to be zero andcreate a dynamic array pointed by list.

• Acopy constructor.

• Afunction named printList to printall the information.

• Afunction named addNewBook which isused to add a new item Y to the beginning of the list and increment count. The function should check first that list is not full and Y is not already in the list.

• ADestructor.

PART(B)



Write a main function totest your class.

• Printthe details of myList1 and myList2.
​

اختي انتي مخليه سؤالين ، واثنينهم بنفس الفكره تقريبا
انا مابقدر اجاوبهم اثنينهم ، بجاوب الأول


هذا حل السؤال الأول


PHP:
#include<iostream>
using namespace std;

class bookList {
      private :
      string *list;
      int size;
      int count;
      public:
             bookList(int = 10);
             bookList(const bookList &);
             void printList();
             void addNewBook(string);
             ~bookList();
             };
             bookList::bookList(int MaxSize){
             size=MaxSize;
             count=0;
             list=new string[MaxSize];    
             }
             
             bookList::bookList(const bookList &obj){
             size=obj.size;
             count=obj.count;
             
             list=new string[size]; 
             for(int i=0 ;i<count ;i++)
             list[i]=obj.list[i];
             }
             
             void  bookList::printList(){
                         for(int i=0 ;i<count ;i++)
                         cout<<list[i]<<" ";
                         cout<<endl;
                         }
                         
             void  bookList::addNewBook(string item)
             { 
             bool found=false;
             if(count<size){
             for(int i=0 ;i<count ;i++)
             if(list[i]==item)
             found=true;
             if(!found){
             list[count]=item;
             count++;}      
             }
             }
             
             bookList::~bookList()
             {delete [] list ;}
             
            int main(){
                 string item;
                 bookList myList1(5);
                 cout<<"Enter the titles of books "<<endl;
                 for(int i=0 ;i<5 ;i++){
                 cin>>item;
                 myList1.addNewBook(item);}
                 
                 bookList myList2(myList1);
                 
                 myList1.printList();
                 myList2.printList();
                 cout<<endl;
                 system("Pause");
                return 0;
                 }


اعتذر على التقصير
واسالكم الدعاء
 
عودة
أعلى أسفل