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

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

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

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

سلام عليكم ..

عندي سؤالين ::

1- شلون نسوي selection sort اذا نبي ال maxindex ??

2- اذا طلبو منه نسوي insert for item :

shift to rigth عادي تكون خارج الفنكشن أو داخلها ؟؟

يعني يصير نسوي فنكشن بروحها للشفت تو رايت تالي نسوي كول .. أو نخلي شفت تو رايت داخل فنكشن الانسيرت ؟؟
 
سلام عليكم ..

عندي سؤالين ::

1- شلون نسوي selection sort اذا نبي ال maxindex ??

2- اذا طلبو منه نسوي insert for item :

shift to rigth عادي تكون خارج الفنكشن أو داخلها ؟؟

يعني يصير نسوي فنكشن بروحها للشفت تو رايت تالي نسوي كول .. أو نخلي شفت تو رايت داخل فنكشن الانسيرت ؟؟

السؤال الاول مو واضح

السؤال الثاني


بشكل عام احنا نسويها كامل داخل function نفسها
بس عادي جداً في التست يلعبون في السؤال ويقولون
Part A
اكتب function تسوي shifting
Part B
call the function that you wrote in part A and insert the item
 
اهاا .. طييبب شكراا .. :99:
 
عندي سؤال حق الsubstr من وين انبدي العد و شلون؟ و يصير تعطوني جم من مثال عشان افهم لاني متخربطة
 
عندي سؤال حق الsubstr من وين انبدي العد و شلون؟ و يصير تعطوني جم من مثال عشان افهم لاني متخربطة

لأستخدام هذي الfunction عندنا حالتين

ناخذ مثال هذا
PHP:
    string str="My name is hussain";

انتبهي ان اول حرف في الجملة وهو M اندكس ماله = 0
يعني نبدأ من الصفر


الحالة الأولى

PHP:
cout<<str.substr(0,7)<<endl;

حطيت رقمين 0 و 7

معناته ابدأ من اندكس 0 ، وقص لي 7 حروف

قص 7 حروف
يعني نروح من اندكس اللي حددنها ونحسب 7 حروف
فـ راح يطبع لنا

My name


مع اعتبار ال space (المسافة) كحرف


الحالة الثانية

PHP:
  cout<<str.substr(3)<<endl;

معناته روح اندكس 3
واقطع ابتداءاً من اندكس 3 الى النهاية

فـ راح يطبع لنا

name is hussain



واضح ان شاء الله

بالتوفيق ، نسألكم الدعاء
 
-



السلام عليكم


عندي سؤال بس ابي اعرف اذا حلي صح او لا ؟


Write a function named insertSum that takes as parameters: an array of integers, number of elements
in the array which is passed by reference, and a constant array size. The function should insert the
sum of two consecutive elements in the array if the value of the sum is less than the value of the
element after the consecutive elements when there is a place in the array to insert new element.
The function prototype is: void insertSum(int arr[], int & length, const int SIZE);
For example, if the following array arr with length 10 and SIZE 15:
0 1 2 3 4 5 6 7 8 9
2 5 20 21 30 35 80 86 110 270
is called then the new values in the arr are


2 5 7 20 21 30 35 65 80 86 110 196 270
. . .


v



هلون حلي :


HTML:
void insertSum ( int arr[] , int &length , int size ) {   while ( lenght < = size )     {  for ( int i=0 ; i<lenght  ; i++)        if ( arr[i]+arr[i+1]<arr[i+2] )          { for ( int j=length ; j > i+1 ; j-- )              arr[j]=arr[j-1];              arr[i+2] = arr[i]+arr[i+1] ;              length ++ ; }     } 
}



:nosweat:
 
التعديل الأخير:
s2al basee6

كود:
[ PART A: 8 Points]
Write  a  function  named  generateNewEmail  which takes string (email) as  a  paramater, where 
email  represents an email address. The function should extract the user name from  email  and 
return a new email for the user on “uob.edu.bh” domain.
Solve this question  by using the functions defined in <string>  library, such as:  length, 
substr, size, swap, and find.
For example,
If email = [email protected], the function should return: [email protected]
string generateNewEmail (string email)  
{
int index=email.find('@'); 
string userName= email.substr(0, index ); 
userName = userName + "@uob.edu.bh"; 
return userName; 
}

mb mafroo6' ena e9eer

كود:
userName = userName + "uob.edu.bh";

bdoon el @ l2na ehya already mawjooda lama est5damna el substr

etha 7sbtooha fee el methal UserA el index e9eer 6 fa el @ included l2nha position malha 6
 
سلام شباب .. في الكلاس
ممكن شرح لانواع الكونستراكتور ؟

متى نعرف ان الفنكشن كونستانت ؟
 
متى نستخدم الاختصارات h,m,s etc.. ومتى نستخدم الفاريابل الاصلي ؟
ومتى نستخدم 2 كونستراكتور ؟
 
s2al basee6

كود:
[ PART A: 8 Points]
Write  a  function  named  generateNewEmail  which takes string (email) as  a  paramater, where 
email  represents an email address. The function should extract the user name from  email  and 
return a new email for the user on “uob.edu.bh” domain.
Solve this question  by using the functions defined in <string>  library, such as:  length, 
substr, size, swap, and find.
For example,
If email = [email protected], the function should return: [email protected]
string generateNewEmail (string email)  
{
int index=email.find('@'); 
string userName= email.substr(0, index ); 
userName = userName + "@uob.edu.bh"; 
return userName; 
}

mb mafroo6' ena e9eer

كود:
userName = userName + "uob.edu.bh";

bdoon el @ l2na ehya already mawjooda lama est5damna el substr

etha 7sbtooha fee el methal UserA el index e9eer 6 fa el @ included l2nha position malha 6

index=5 لأن يبدي من 0 :smile2:
 
سكشن 6 يوسف حراث
الامتحان وين ؟
 
سلام شباب .. في الكلاس
ممكن شرح لانواع الكونستراكتور ؟

متى نعرف ان الفنكشن كونستانت ؟

contractor نوعين ..
- default
- with parameters

const : يعني الدالة ما تقدر تعدل القيم اللي داخل الكلاس ..
 
-

السلام عليكم


عندي سؤال بس ابي اعرف اذا حلي صح او لا ؟


Write a function named insertSum that takes as parameters: an array of integers, number of elements
in the array which is passed by reference, and a constant array size. The function should insert the
sum of two consecutive elements in the array if the value of the sum is less than the value of the
element after the consecutive elements when there is a place in the array to insert new element.
The function prototype is: void insertSum(int arr[], int & length, const int SIZE);
For example, if the following array arr with length 10 and SIZE 15:
0 1 2 3 4 5 6 7 8 9
2 5 20 21 30 35 80 86 110 270
is called then the new values in the arr are


2 5 7 20 21 30 35 65 80 86 110 196 270
. . .


v



هلون حلي :


HTML:
void insertSum ( int arr[] , int &length , int size ) {   while ( lenght < = size )     {  for ( int i=0 ; i<lenght  ; i++)        if ( arr[i]+arr[i+1]<arr[i+2] )          { for ( int j=length ; j > i+1 ; j-- )              arr[j]=arr[j-1];              arr[i+2] = arr[i]+arr[i+1] ;              length ++ ; }     } 
}



:nosweat:

أعتقد تصير جذي .. :smile2:

كود:
void insertSum ( int arr[] , int &length , int size ) 
{
	int i=0;
	while( i<length)
	{
		if (arr[i]+arr[i+1]<arr[i+2] && length+1<=size)
		{
			for ( int j=length-1 ; j>=i+2 ; j-- )
				arr[j+1]=arr[j];
			arr[i+2]=arr[i]+arr[i+1];
			length ++ ;
			i+=2;
		}
		else
			i++;
	}
}
 
سكشن 5 وينن الامتحان ؟؟؟ دكتورة نادية
 
عودة
أعلى أسفل