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

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

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

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

السلام عليكم ..

راح يتم تخصيص هذا الموضوع ان شاء الله,
لمناقشة المقرر,

ITCS 102

للفصل الصيفي ..

مواضيع سابقة,,


ITCS 102 للدراسة و المناقشة, الفصل الدراسي الثاني
https://www.uob-bh.com/forum/showthread.php?t=4952

صفحة المقرر في المكتبة .. تحتوي على ملفات خاصة بالمقرر و امتحانات سابقة
https://www.uob-bh.com/forum/downloads.php?do=cat&id=3


الحلول الجاهزة ممنوعة,, و سيحذف الرد,
و محاولات حل الاسايمنتات سيتم حذفها, حفاظاً على تعب الطالب ..


بالتوفيق للجميع​
 
السلام عليكم

سكشن 4 دكتور طاهر

في اي سكشن خلوكم؟

وش عطوكم لحد الحين؟
​
 
لو قعدت اهني بستفيد يبين لكم او انتظر لما اخذ المقرر؟؟ اني هالمقرر كان يعارض مع مقرر ثاني والمقرر الثاني اهم من هذا

وقلت بحاول استفيد بس بستفيد يعني لو دخلت اهني؟؟
 
لو قعدت اهني بستفيد يبين لكم او انتظر لما اخذ المقرر؟؟ اني هالمقرر كان يعارض مع مقرر ثاني والمقرر الثاني اهم من هذا

وقلت بحاول استفيد بس بستفيد يعني لو دخلت اهني؟؟

ما اعتقد تستفدين شي من الموضوع و انتين مو مطلعة على شي في المادة :nosweat:

خصوصا ان صيفي و ما في تفاعل نفس الفصول العادية

:shiny: الكتاب بتستفدين منه ازيد .... و من ردرود الأعضاي مجرد بتاخذين فكرة عن المادة :rolleyes2:
 
الدكتور عطانه اليوم
Tutorial #1 Array Applications





1

write a function called search for last occurence that takes as parameters an array of integers, an integer key value, and the array size. the function should search for the last occurrence of the key value in the array and return its position in the array, or return -1 if the value is not found in the array.

the function prototype is: int search for last occurence (int arr[ ],int key, int size);​


2

write a function called display all occurences that takes as parameters an array of integers, an integer key value, and the array size . the function should search for all occurrences of the key value in the array and display their position in the array , i the value is not found in the array , the function should display a message saying that the value is not found i the array.

the function prototype is; void display all occurences (int arr[ ], int key , int size);​



3

write a function named insert new element that takes as parameters: an array of integers, an the number of elements in the array. assume that the elements in the array are sorted in ascending order, the function should add the new element in a way that the element in the array will remain sorted.

the prototype of the function is; void insert new element (int arr[ ], int new element , int length);​


4
part A

write a function named shift to right that takes as parameters: an array of integers, array length which is passed by reference ,and a position (index) in the array pos. the function should shift the elements of the array on step to the right from pos an increment the array size by 1.

the prototype of the function is; void shift to right (int arr[ ], int & length, int pos );​


4
part B

write a function named insert one 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 '1' after all occurrences of the sequence '100' un the array when there ia a place in the array to insert new element. use the above function shift to right to shift the elements before insertion.

the prototype of the function is; void insert one (int arr[ ], int & length, const int size );​



5
part A

write a function named insert at position that takes an array of integers x , the number of elements stored in the array which is passed by reference xnum , a positive integer pos that represents a position (subscript) in the array , and an integer number value. the function should insert the value at the position specified pos.

the prototype of the function is; void insert at position (int x[ ], int & xnumptr, int pos, int value );
if pos=2, value=10, and the content of the array xbefore calling the function is:​




5
part B

write a function named insert seven that takes an array of integers x , the number of elements stored in the array which is passed by reference xnum ,and the maximum array size max-size. the function should insert the number seven(7) in the proper position. the number of elements stored in the array should not exceed max-size.
the prototype of the function is; void insert seven (int x[ ], int & xnumptr, intmax-size);
 
اني مسجلة في سكشن 2 .. عند د.ناديه .. الحين يجينا د. راكيش مادري ليش .. بس شرحه تمام ماعليه كلام

الدكتور عطانه هالبروقرام .. لما تيبته طلع فيه ايرور .. عدلته من الكتاب .. وبعد في ايرور ..​





PHP:
# include <iostream> 
using namespace std ; 
const int size = 10 ; 
int seqsearch ( const int list[] , int length , int searchkey ); 
int main () 
{ 
    int list [size] ; 
    int key , index , searchkey;  
    cout << "Enter"<<size<<"integers:"<<endl; 
    for ( int i=0 ; i < size ; i++ ) 
        cin >> list[index] ; 
    cout << " Enter the key to be searched : " ; 
    cin >> key ;  
    index = searchkey( list , size , key ); 
        if (index != -1) 
            cout << key << " is found at position : " << index << endl ;  
        else  
            cout << key << " is not in thw list . " << endl ;  

    system ("pause"); 
    return 0 ;
}
هذا الايرور الا يطلع:​

كود:
term does not evaluate to a function taking 3 arguments
 
اختي في الindex لازم تساوينه باسم الفنكشن ليش حطيتينه يساوي شي من الباراميترز الي في الفنكشن !!!!

ما يصير

لازم يصير index = seqsearch( list , size , key );

و اذا تبين البرنامج يشتغل لازم تكتبين الفنكشن تحت عشان يطبق البرنامج عليها

:confused: لأن عرفتين الفنكشن فوق لكن ما كتبتينها !!!
 
اذا ممكن اللي عنده نوتات او اي شى شرح الى cs102

سلام
اذا ممكن اللي عنده نوتات او اي شى شرح الى cs102 يعني اذا ماعليكم امر....
 
سلام
اذا ممكن اللي عنده نوتات او اي شى شرح الى cs102 يعني اذا ماعليكم امر....

نوتات ما عندي, تقريباً ما كنت أكتب شي وي الدكتورة :shiny:

شرح, من واحد أعرفه,

binary search
هذه الفنكشن تبحث عن العنصر في الاري ولازم تكون الاري اللي نبحث فيها مرتبه تصاعديا او تنازليا.

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

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

** اذا كان العنصر اللي في الوسط اصغر تقوم الفنكشن تاخذ النص الثاني وتقسمه الى قسمين وتاخذ تاعنصر اللي في الوسط وتشوف اذا اكبر او اصغر من العنصر اللي ابحث عنه.

** اذا العنصر اللي في الوسط يساوي العنصر اللي ابحث عنه يعني وجدنا العنصر ونرجع المكان اللي هو فيه .

** اذا وصلنا الى النهايه وما حصلنا العنصر اللي ابحث عنه نرجع -1

الفنكشن :



************************************************
Bubble sort

هذه الفنكشن ترتب الاري ونقدر نغير الاشاره اللي في if علشان نختار نرتب تصاعدي او تنازلي

فكرتها سهله :
تقارن بين كل عنصرين صوب بعض يعني بين الاول والثاني من الاري اذا الثاني اصغر تقوم تغير بين الاول والثاني
وعقب تروح الى الثاني والثالث وتشوف اذا الثاني اكبر تقوم تغير بينهم النتيجه اذا وصلنا الى نهايه الاري راح يكون اكبر رقم في نهايتها

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

وتظل الفنكشن تعيد مثل الطريقه حتى نرتب كل العناصر .

*************************************************
selection sort

هذه بعد ترتب الاري لكن طريقتها غير

في البدايه ناخذ اول عنصر من الاري ونبحث عن اصغر عنصر في الاري كامل ونقوم نبدل بين اصغر واحد والعنصر الموجود في اول خانه من الاري
وبعدين نروح الى الخانه الثانيه نبحث عن ثاني اصغر عنصر ونقوم نبدل بين العنصر اللي في الخانه الثانيه واثاني اصغر عنصر

وجدي حتى تترتب الاري كامل

************************************************

+++

ماعرف صاحب هالشرح


1-intialize :

PHP:
void intialaze (int arr [ ] , int size ) {
for (inti=0 ;i<size ; i++)
arr[i]=0 ;
}
2- ندووور عنصر في الاري :

PHP:
int search ( int arr [ ] , int size ,int item ) {

for ( int i=0 ; i<size ; i++){
if ( arr[ i]==item )
return i ; 
}
return -1 ; 
{

3- ترتيب تصاااعدي ..
PHP:
void sort ( int arr[ ], int size ){
for ( int i=0 ; i<size : i++)
for ( int s=0 ; s<size; s++)
if (arr[ s]<arr[i]
{
int x=arr[s];
arr[s]=arr[i[;
arr[i ]=x;
}
}


4-نحسب اصغر عنصر :
PHP:
int getmin ( int arr[ ] , int size ){
int min =arr[ 0 ] ;
for ( int i=0 ; i<size ; i++)
if (arr[i]<min )
min=arr[i];

return min ;
{

5- نحسب المااكسيمم ..
PHP:
int getmax (int arr[ ] , int size ){
int max=arr[ 0 ] ; 
for ( int i=0 ; i<size ; i++)
if ( arr [i]>max)
max=arr[0];

return max ;
{


6- نبدل بين عنصرين :

PHP:
void swap ( int arr[ ],int size,int first , int second ){
int temp = arr[first ];
arr[first]=arr[second];
arr[second]=temp;
{

8- نسووي دليييت لعنصر من العنااصر :
PHP:
void delete ( int arr[ ], int size , int item ){
int x; 
for (int s=0 ; s<size; s++)
if (arr[s]==item)
x=s;
for ( int i=x; i<size ; i++){
arr[i ] =arr[i+1];
{
{

9-نطلع الافريج :

PHP:
double avarege (int arr[ ] , int size ){
double sum=0 ;
for ( int i=0 ; i<size; i++)
sum+=arr[i];

return (sum/size);
{

9- نشوووف اذاا كاان الرقم اليي دخله اليووزر مسااويي للعنصر اليي هوو حدد البوويزيشن مالته ..

PHP:
bool isitem_equal (int arr[ ] ,int size, int location ,int item ){
if ( arr[location ]==item )
return true ;

return false ;
{

10-copy :
PHP:
void copy (int arr[ ] , int carr[ ], int size ){
for ( int i=0 ; i<size ; i++)
carr[i ]=arr[i];
{


11- نطبع ...

PHP:
void print (int arr[ ] , int size ){
for (int i=0; i<size ;i++)
cout <<arr[i]<<end;'
{

12-نطبعهم بالعكس ..

PHP:
void print _revrese (int arr[ ], int size){
for ( int i=(size-1);>=0 ;i++)
cout <<arr[i]<<" " ;
{
cout <<endl;
{


++

في الشرح اللي كنت أكتبه الكورس اللي طاف يوم كنت آخذ المادة,
و اللي يكتبونه بعد الباقين

insert + delete
https://www.uob-bh.com/forum/showthread.php?t=4952&p=38637&viewfull=1#post38637


هذا بس جبتر 10 ,,
الجباتر الباقية أسهل منه, و مو كلها مشروحة
بقعد أدور الشروح و ان شاء الله بحطهم هني​
 
  • Like
التفاعلات: Ali.4
سؤال ذكي:::

اشلون نعرف متى نستخدم الباينري سيرش او سيكوانشغ اوردر سيرش؟؟
اللي لاحظته ان الفرق بينهم ( في الباينري السيرش يصير على عنصر موجود في القائمة) عكس السيكوانشنغ...... اعتقادي صحيح؟!


في السورت ...(الي اعرفه انه البوبل المقارنة تصير في كل عنصرين ورا بعض) (لكن السيلكشون اخذ اول عنصر واقارنه مع الباقي بعدين اخذ ثاني عنصر واقارنه...ألخ)..لكن في لكن ماعرف متى استخدم البوبل او سيلكشون ..هل في السؤل يحددون هالشي؟؟
 
سؤال ذكي:::

اشلون نعرف متى نستخدم الباينري سيرش او سيكوانشغ اوردر سيرش؟؟
اللي لاحظته ان الفرق بينهم ( في الباينري السيرش يصير على عنصر موجود في القائمة) عكس السيكوانشنغ...... اعتقادي صحيح؟!


في السورت ...(الي اعرفه انه البوبل المقارنة تصير في كل عنصرين ورا بعض) (لكن السيلكشون اخذ اول عنصر واقارنه مع الباقي بعدين اخذ ثاني عنصر واقارنه...ألخ)..لكن في لكن ماعرف متى استخدم البوبل او سيلكشون ..هل في السؤل يحددون هالشي؟؟

بخصوص استخدام أي نوع, هم يحددون في السؤال,, :icon30:
بس الفرق بين الـ sequantial و الـ binary
اثنينهم لازم ندور على شي موجود في الـ list
و اذا ما حصلناه هذا شي ثاني,
بس ما يصير نسوي سيرج و احنا ندري ان الـ item مو موجود في الـ list
الفرق بينهم هو الطريقة,
الـ sequantial in ordered list طريقته ان نسوي sequantial search عادي, بس الفرق ان الـ list راح يكون مرتب, من جذي, اذا حصلنا أي عدد أكبر من العدد اللي ندور عنه, راح نقول خلاص ما حصلناه,,

لكن الـ binary طريقته,
نقسم الـ list إلى قسمين,
نجي للنقطة اللي نقسم عندها, نجيك اذا كان العدد أصغر من المطلوب, نروح ندور في القسم اللي عقب نققطة النص, اذا كان أكبر, ندور في القسم اللي قبل نقطة النص,,
و هذا القسم نفسه,, نسوي فيه مثل الشي,
نقسمه قسمين, و نجوف نقطة الوسط, أكبر أو أصغر,,
لين ما نحصله,​
 
مافي نوتات حق دكاترة او اي شي
غير عن الي موجود في المكتبة
 
مافي نوتات حق دكاترة او اي شي
غير عن الي موجود في المكتبة

لا والله,:nosweat:
بس هذلين الموجودين,
انا ما عندي إلا الشرح اللي انكتب في الموضوع الأولي,
قلت حق "ماث ستيودنت" بجمع اللي انكتب و للحين ما حصلت وقت أجمعهم فيه,
مادري اذا كانو يفيدونكم جذي أو لا أصلاً​
 
102 ... أسهل من 101 .. ،،
والاحسن ان خذيته صيفي .. !
 
هذي محاضرتنا تبع اليوم 26-7-2010 الاثنين - دكتور راكيش كومار و عذرا اذا كان في أي أخطاء .. :nosweat: .​

chapter 12 : Classes and Data Abstraction .

Array of object:
Each element of the array is an object.

Ex:
680167763.gif


Assume that employee number = array index .

Program 1 :
PHP:
]# include <iostream>
using namespace std ;
const int SIZE = 100 ; 
int main () 
{
clockType arrivalTime[SIZE];
departTime[SIZE] , timeWorked[SIZE];
employee empList [SIZE];
int count , hours , minutes , i ;
float hourlyRate , dialyPay[SIZE];
cout<<"Enter number of employee : " ;
cin >> count ;
cout<< " Enter hourly payment rate : " ; 
cin >> hourlyRate ;
fot (i=0 ; i<count ; i++)
{
cout << " Enter arrival time of employee : " << i+1 < " : " ;
cin >> hours >> minutes ; 
arrivalTime[i].setTime(hours,minutes,0)
cout<<" Enter departure time of employee" << i+1 << " : " ; 
cin >> hours >> minutes ;
departTime[i].setTime (hours , minutes , 0);
}
for (i=0 ; i<count ; i++)
{
timeWorked [i].departTime[i].diffTime(arraivalTime [i]);
dailyPay[i]=(timeWorked[i].getHour() + timeWorked[i].getMinute()/60.0)*hourlyRate;
cout << " Pay for employee # " << endl ; 
}
return 0 ; 
} 


system ("pause");
return 0 ; 
}
// t2.diffTime(t1)--> t2- t1

PHP:
# include <iostream>
# include <string>
using namespace std ; 
class employee
{
private :
	string firstName ;
	string lastName ;
	int empNum ; 
	float hourlyRate ;
public :
	employee (string first = " " , string last = " " , int num = 0 , float rate = 0.0);
	void setName (string first , string last );
	string getFirstName () const ;
	string getLastName () const ;
	int getempNum () ;
	void setHourlyRate(float rate);
	float getHourlyRate ()const ;
	void print () const ; 
};

Function :

PHP:
void comparePay (clockType arrival [] , clockType depart [] ; float pay [] ; employee emp [] , int size )
{
	clockType timeWorked [SIZE];
	for(i=0 . i<size , i++)
	{
		timeWorked [i].depart [i].diffTime (arrival [i]);
		pay[i] = (timeWorked[i].getHour() + timeWorked[i].getMinute()/60.0 ) * emp[i].getHourlyRate ();
	}

Types of Function :
1) Member function (part of the class)  itcs 102 .
2) Non-member functions (stand alms functions) itcs 101 .

10:40:50 + 2:30:20 --> 50+20 = 70  70/60 = 10 , 40+30+1=71  71/60 = 11 , 10+2+1 = 13 .

The time = 13 : 11 : 10 .


Write a function outside the class , in which parameter is an object .
PHP:
void advanceTime (clockType& t , unsigned int h ,unsigned int m , unsigned int s)
{
	int i ;
	for (i=0 ; i<s ; i++)
		t.incrsec ( );
	for (i=0 ; i<m ; i++)
		t.incrmin ( );
	for (i=0 ; i<h ; i++)
		t.incrHr ( );
}

// Another Solution : 

void advanceTime (clockType& t , unsigned int h , unsigned int m ,  unsigned int s )
 unsigned int h1 , m1 , s1 , h2 , m2 . s2 ;
t.getTime (h1,m1,s1)
s2 = s + s1 ;
m2= m + m1 + s2 / 60 ; 
h2 = h + h1 + m1 / 60 ;
s2 = s2 % 60 ;
m2 = m2 % 60 ; 
h2 = % 24 ;
t.setTime (h2 , m2 , s2);
}

constant object:
PHP:
const clockType noon(12 , 0 , 0);[/

Object noon is a constant object and it is not modifiable . Member function can not be called fot constant object unless the member function are also declared const .

Ex :
PHP:
int main ()
{
	clockType t1 (10,30,0);
	const clockType noon (13 , 0 , 0 );
	t1.setTime (8,15,30); // valid 
	noon.setTime (13,30,0); //Invalid 
	cout <<"Time t1 : " << t1.getHour() << " : " << t1.getMinute()<< " : " << t1.getsecond() << enl ; // valid 
	cout << " Noon " << noon.getHour() << " : " << noon.getMinute() << " : " << noon.getsecond() << endl ; // valid 
	return 0 ; 
}

Constant data member :
PHP:
class Increment 
{
private : 
	int count ;
	const int incr;
public : 
	Increment (int c=0 , int i=1);
	void addTncr () ; 
	void print () const ; 
} 
//constructure 
Increment :: Increment(int c , int i )
:incr (i)// initializer
        // incr i , // invalid 
count = c ; 
}

void Increment :: addIncr ()
{
	count = count + incr ;
}
valid Increment :: set Incr (int i )// Invalid
{
	incr i 
}

Static member of a class :
static data members :
For each static data members of a class , C++ allocated only one memory space for all objects .

PHP:
class student 
{
private : 
	string name ;
	string idNum ;
	float marks ;
	static float maxMarks ;
public :
	student (string , long , float);
	string getName()const ; 
	long getIdNum()const ;
    float getMarks() const ;
	static float getMaxMarks () const ; 
	void print () const ; 
} ;


Static member variables must be initialized .

PHP:
student :: maxMarks = 0 ; 
// constructure 
student :: student (string stdName , long IdNum , float stdMarks )
{
	name = stdName ; 
	idNum = stdId ;
if (stdMarks > maxMarks )
    maxMarks = stdMarks ;
}
float struct :: getMaxMarks ()
{
	return maxMarks ;
}

-Non-static data members of a class are called instance variables of the class .
-Each object of class has its own copy of instance variables .
-Static data member of a class exist even when no object of that type are created .

​
 
لو سمحتو بغيت مساعدتكم في اسايمنت iitcs 102

لو سمحتو عندي اسايمنت سويته بس مو عارفة ااذا فيه اغلاط ولالا

ياريت احد يجوفه لي واذا فيه اغلاط يقولي عليها

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

مابطول عليكم ياريت الي متبرع يساعدني يطرشلي عالخاص وانا باطرشه له لان مايصير احطه اهني ضروري الله يخليكم انا عندي لي باجر بس
:confused::confused:
 
بليز ابي احد يشرحلي اشلون ادخل درجتين لكل طالب في array
 
لو سمحتو بغيت احد يشرحلي اشلون ادخل درجتين لكل طالب في ال array
 
في احد حل اخر اسايمنت ؟؟؟

انا بصراحة حليته وشيرت فيه وصلت للنص وماعرفت ااكمله ...

االلي حله يحط لنا اهني بليززز

اخر يوم باجر لازم اسلمه ضروري

مشكووووووووووووورين

:)
 
عودة
أعلى أسفل