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

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

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

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

Write a recursive function named Rightdigit. The prototype of the function is:
int Rightdigit(int n, int k);
This function returns the kth digit of the positive integer n.
For example, if n is the integer 29815:
The call Rightdigit (n,0 ) would return the digit 5
The call Rightdigit (n,2)would return the digit 8.
Note that the digits are numbered from right to left beginning with the “zeroth digit.”

الحل
PHP:
int Rightdigit(int n, int k)
{
	if(k==0)
		return (n%10);
	else
	{
		n=(n/10);
		return Rightdigit(n,k-1);
	}
}

ما فهمت السؤال
شلون سوينا جدي
 
^^
يعني عندش n اللي هو الرقم و عندش k هو عبارة عن الموقع اللي تبين اطلعين قيمته
مثلا المثال اللى هم حاطينه عندش 29815 هذا n و k اذا كانت صفر فلازم الناتج اللى ترجعه الفنكشن هو رقم خمسه ولو كان k يساوي 2 فالناتج اللى ترجع 8 وهم يبدأون يحسبون الرقم من جهة اليمين فرقم 8 بيطلع في الوكيشن 2 اتمنى انش فهمتين عليي
سوي نفس الطريقة اللى راويتكم اياها بالرسم وبتعرفين
 
^^
يعني عندش n اللي هو الرقم و عندش k هو عبارة عن الموقع اللي تبين اطلعين قيمته
مثلا المثال اللى هم حاطينه عندش 29815 هذا n و k اذا كانت صفر فلازم الناتج اللى ترجعه الفنكشن هو رقم خمسه ولو كان k يساوي 2 فالناتج اللى ترجع 8 وهم يبدأون يحسبون الرقم من جهة اليمين فرقم 8 بيطلع في الوكيشن 2 اتمنى انش فهمتين عليي
سوي نفس الطريقة اللى راويتكم اياها بالرسم وبتعرفين

اي فهمت السؤال
مشكورة بتعبش ويايي
 
ما فهمت السؤال
شلون سوينا جدي


K هو الموقع
n الرقم الي تبيه

الارقام الي حآطينهآ هي n والمطلوب مثلا يدور على 0 فيقوم يرجع القيمه الي مخزنه ب 0 وهي 5 مثلا طلبتي منه 4 يقوم يطلع 2 وهكذآآآ
 
ههه تأخرت بالرد يعطيكي العآفية مآآث لفر
مآ شآء الله عليكي اسلوبك روعه في التوضيح
 
^^
العفو عزيزاتي

تبون نحل اسئلة بعد
 
اي يا ريت على البوينتر مسأله على السريع مثلا:msn-wink:
 
ههه تأخرت بالرد يعطيكي العآفية مآآث لفر
مآ شآء الله عليكي اسلوبك روعه في التوضيح

توي بقول مواصلة وياها انـــي

ياريت لو تحلي بعد الفاينل الثاني نكون اليـــش شاكريـــن
 
احد يعرف يحل هالسؤال
Using the following class definition of a Matrix; implement the copy constructor of the
class Matrix that create dynamically the matrix (size X size) and initialize it by the received
matrix (use deep copy).
class Matrix {
private:
int size;
double **Mat;
public:
Matrix()
Matrix(const Matrix& m)
bool isIdentity();
Matrix inverse();
void print();
~Matrix();
};

انآ هالسؤال مآ استوعبته
شنو المقصود فيه ممكن توضحي ؟؟
 
Question 1 [ 18 Points]
Consider the following definition of the class Employee:
class Employee
{ private:
string * firstName;
string * lastName;
static int empCount;
public:
Employee(string first, string last);
~Employee();
string getFirstName();
static int getEmpCount();
static int counting;
};
PART (A) [8 Points]
Write the definition of the constructor function Employee(string first, string
last); which dynamically allocates memory for firstName and lastName and copies first
and last to them. The function should increment empCount by 1. Use deep copy.
PART (B) [4 Points]
Write the definition of the function ~Employee() which deallocates the dynamic memory and
decrease the value of empCount by 1.
PART (C) [3 Points]
Write the definition the function getEmpCount() which returns the value of empCount.
PART (D) [3 Points]
In the main function add statements to do the following:
· Using the following declarations: string first=”Sami”, last=”Noor”, create an object of
type class Employee named xEmp.
· Increment the value of counting in xEmp by 1.
· Print the value of empCount.


ياليت اتحلين هالسؤال
 
^^
هو الكوبي كونستركتر بس ان اتسوين تو دايمنشن اري
 
وردة النرجس حليته بس مو متأكده منه
بس اذا تبينه بخليه ليش
 
محد عنده امتحآن الكورس الي طآآف ؟؟
انآ قلت لدكتورة ابيه قعدت تقول حلي التيتوريال كفايه
 
^^
لا هو نفسه الكوبي كونستركتر بس في هذي الحالة يكون تو دايمنشن اري
يعني اذا تعرفين طريقة الكوبي كونستركتر + تو دايمنشن اري
اربطيهم ببعضهم

أتمنى فهمتين عليي
 
اييي شكرآ اختي الحين بحله عقب بطآلع الحل واتاكد من حليي
 
Consider the following definition of the class Employee:
class Employee
{ private:
string * firstName;
string * lastName;
static int empCount;
public:
Employee(string first, string last);
~Employee();
string getFirstName();
static int getEmpCount();
static int counting;
};
PART (A) [8 Points]
Write the definition of the constructor function Employee(string first, string
last); which dynamically allocates memory for firstName and lastName and copies first
and last to them. The function should increment empCount by 1. Use deep copy.

الحل:
PHP:
Employee::Employee(string first, string last)
{  firstName=new string; lastName=new string;
   *firstName=first; *lastName=last;
   empCount++;
}

PART (B) [4 Points]
Write the definition of the function ~Employee() which deallocates the dynamic memory and
decrease the value of empCount by 1.

PHP:
Employee::~Employee()
{ delete firstName; firstName=NULL;
  delete lastName;  lastName=NULL;
  empCount--;
}

PART (C) [3 Points]
Write the definition the function getEmpCount() which returns the value of empCount.

PHP:
int Employee:: getEmpCount()
 { return empCount; }

PART (D) [3 Points]
In the main function add statements to do the following:
· Using the following declarations: string first=”Sami”, last=”Noor”, create an object of
type class Employee named xEmp.
· Increment the value of counting in xEmp by 1.
· Print the value of empCount.

PHP:
 int main()
 { Employee xEmp("Sami","Noor");
   Employee::counting++;
   cout<<xEmp.getEmpCount();
 }

ياليت احد يتأكد من حلي لان في اشياء في هالسؤال ما فهمتها بس حاولت احلها يعني في اشياء اول مره اشوفها
 
PHP:
int * mystery (int * list, int size)
{
int * result = new int[size];
for (int i=0, j=size-1; i<size;i++,j--)
result[j]=list[i];
return result;
}
void printArray(int * list, int size)
{
for (int i=0; i<size; i++)
cout<<list[i]<<endl;
}
int main()
{
int x[]={10,20,30};
int * pX = mystery(x,3);
printArray(pX,3);
return 0;
}

output
30
20
10
 
PHP:
void f1(int x, int & y, int *z)
{
x++;
y++;
(*z)++;
}
int main()
{
int i=1, j=1, k=1;
f1(i, j, &k);
cout<<i<<"\t"<<j<<"\t"<<k<<endl;
return 0;
}

the output:
1 2 2
 
int main()
{ Employee xEmp("Sami","Noor");
Employee::counting++; >>> هالستيتمن ليــش جدي حليه يعني قصدي ليش خليتي ::مو المفروض .

cout<<xEmp.getEmpCount();
 
عودة
أعلى أسفل