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

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

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

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

وعدتكم ان احل ليكم الصبح سؤال
فانتظروا اشوي على ما اكتب الحل وبنزله ليكم
 
ثانكس خيووه
 
Question 1 [ 20 Points]
Given the following class definition, solve parts (A) and (B) below:
class Shopping_Mall
{
private:
string name; //shopping mall name
int count; //number of shops in the Shopping_Mall.
int maxSize; // max size of shops in the Shopping_Mall.
string *shops; //dynamic array holds the names of shops
public:
Shopping_Mall(const Shopping_Mall & another); //Copy constructor
Shopping_Mall(string n, int size);
Shopping_Mall();
void addShop(string);
string getName(){return name;}
void displayShops()
{ for (int i=0; i<count;i++)
cout<<shops<<endl;
}
~Shopping_Mall();
};
PART A [10]
Write the code of the following functions:
1. [7 Points] The Constructor function Shopping_Mall(const Shopping_Mall &
another); which is the Copy constructor that initializes the data members name, count,
maxSize and allocates dynamically one dimensional array pointed to by shops. The array
Shops contains the names of the shops in the mall. The function should copy the content of
the object another to the current object. Use deep copy.

الحل:
PHP:
Shopping_Mall::Shopping_Mall(const Shopping_Mall & another)
{
	name=another.name;
	count=another.count;
	maxsize=another.maxsize;
	shops=new string[maxsize];
	for(int i=0;i<count;i++)
		shops[i]=another.shops[i];
}

[3 Points] A Destructor function to destroy all dynamically allocated memory.

PHP:
Shopping_Mall::~Shopping_Mall()
{
	delete[]shops;
	shops=NULL;
}

PART B [10 Points]
Write a function with the function heading:
void display_Mall_Shops(Shopping_Mall malls[], int size, string mall_name); which
takes as parameters an array malls which contains objects of type Shopping_Mall, the
number of shopping malls in the array (size), and a name of a shopping mall
(mall_name). The shopping malls are sorted in the array Malls_List according to the
shopping mall name in ascending order. The function should use binary search to search
for the shopping mall in the array and then print the names of all shops in that mall using
the function display_Mall_Shops. If the shopping mall is not found, then print a message
saying that the required shopping mall is not in the list.

PHP:
void display_Mall_Shops(Shopping_Mall malls[], int size, string mall_name)
{
	bool found=false;
	int first=0; int last=size-1; int mid;
	while(first<=last)
	{
		mid=(first+last)/2;
		if(malls[mid].getName()==mall_name)
		{
			malls[mid].displayshopes();
			found=true;
		}
		else if(malls[mid].getname()>mall_name)
			last=mid-1;
		else
			first=mid+1;
	}
	if(found==false)
		cout<<"the required shopping mall is not in the list";
 
يلا دعواتكم لنا :bye1:
 
بالتوفيق يا رب وشكرآ جزيلآ عمجهودك الكبير
يعطيكي العآفية يآ رب
 
موفقين جميعا

دعواتكم
 
ها ؟؟

بشروا ان شاء الله سويتون كشوخي ؟

​
 
زفت والحمدلله
 
في اسئلة مافهمتهم وفي اسئله حليتهم وشكلهم غلط
ماعندي الا الاوت بوت ويمكن غلط بعد ما ادري
ماادري ويش سويت
سئلة الدكتور نصر الدين حلام مافهمت ليه يتكلم ما ادري فرنسي
 
انآ مآ ادري من الدكتور الي كنت اساله
بس دكتور صج مآ ينفهم عليه بس كآن صج يبي يسآعدني ويفهمني
انآ بصرآحة مآ فهمت سؤال البوينت صج هذي تعقدت
حطيت اشيآء من عندي والفت
حطيت فور لوب وطبعآ بل اكيد الي دآخلهآ غلط قلت بعد كونت++ وحطيت اف ستيتمنت من عندي اكيد غلط
هوة بشكل عام الفكرة العامه لسؤال فهمتها واكتب اشياء صحيحه لكن مكآنت مرتبة ولا مضبوطه
الاوت بوت وآحد منهم اوكي كآن والياقين الفت
يمكن بس الكلاس اوكي الريكيرجن اوكي التمبلت جزء منه اوكي الباقي
يعني الله يستر زين لو احصل C ولا D خلاص صآر حلم ال A or B
​
 
صحيح نسيت اقول الامتحآن بشكل عآم مبآشر بس سؤال البوينتر شوي يبيله تشغيل مخ
بس نسبيا الاسئلة سهلة والمشكلة فينآ احنآ
​
 
يعني الله يستر زين لو احصل C ولا D خلاص صآر حلم ال A or B
ايييييييييي والله بس ابي انجح وافتك لان صج صج خربطت من قلب :RpS_mad:
 
انه واجهت مشاكل في اخر سؤال لوع جبدي وحليته بطريقه مو نفس الى يبونها
بس الله كريم
ان شاء الله كلنا نيب درجه حلوه... وادا ماصار مجال اهم شي نطوف بعدين اصير خير ههه :nosweat:
 
عودة
أعلى أسفل