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

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

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

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

مشكووور سيد يعطيك العافية على الشرح
 
بحل كم سؤال من الورقه الا عطونا اياها وبجي

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

الا مع رمزي

روحي معهد ..رمزي صراحه مأساه مادري شلون يفهمون عليه مادري

...

اول سؤال

write a function named searchForLastOccurence that taxes as parameters on last occurence of the key value in the erray and return its position in the array, OR return -1 if the value is not found in the array, the function prototype is:
int searchForlastOccurencce(int arr[],int key,int size);
PHP:
#include<iostream>
using namespace std;
{
int searchforlastOccurence (int arr[],int key,int size);
{
int i;
for(i=0;i<size;i++)
if (arr[i]==key)
return i;
return -1;
}
}
void main()
{
int arr[100];
int key,size;
cout<<"enter the number of elemnt in the arry"<<endl;
cin>>size;
// cout<<"enter the elemnt"endl;
for(int i=0;i<size;i++)
cout<<"enter the key"<<endl;
cin>>key;
}


اكو عدلت الفنكشن او بالاحرى عدت صياغتها ...
واستخدامها بال main سهل كلش
وترى القصد من السؤال ..:
ان الفنكشن ترجع موقع آخر موقع الى الرقم الي نفس رقم الkey داخل الاريه
يعني لو الكي كان 1 والاريه 1 4 2 5 1 .. الفنكشن بترجع رقم 4 < الي هو موقع رقم ال1 الي تكرر آخر مرة في الاريه

PHP:
int searchforlastOccurence(int arr[],int key,int size)
{
int pos=-1;
for(int i=0; i<size; i++)
{ if(arr[i]==key)
pos=i;
 
}
if(pos==-1)
return -1;
return pos;
 
}
 
مشكله إذا افهم السؤال غلط

هو إذا فهمته صح مو شرط احله صح

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

خاله في بالي صراحه اجيب زين ..

لازم اعرف كل شيء اليوم لأن بكرى في اختبار عليهم كلهم ..

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



خيو الكود الثاني هو مال السؤال الثاني؟؟ يعني كودي مو كلش سيء وكنت متوقعه جدي بس قلت مو معقوله بس جدي

والكود الأولي مال سؤالي الأولي؟؟
 
سلااام .....

هذا المثال في الكتاب ..

PHP:
#include<iostream>
using namespace std;
const int ARRAY_SIZE=10;
int seqSearch(const int list[], int listLength, int searchItem);
int main()
{
	int intList[ARRAY_SIZE];
	int number;
	int index;
	cout<<"Line 4:Enter"<<ARRAY_SIZE
		<<"integers."<<endl;
	for(index=0;index<ARRAY_SIZE;index++)
		cin>>intList[index];
	cout<<endl;
	cout<<"Line 8:Enter the number to be"
		<<"searched: ";
	cin>>number;
	cout<<endl;
	index=seqSearch(intList,ARRAY_SIZE,number);
	if(index!=-1)
		cout<<"Line 13: "<<number
		<<"is found at position"<<index
		<<endl;
	else 
		cout<<"Line 15: "<<number
		<<"is not in the list."<<endl;
	system("pause");
	return 0;
}

ابي اعرف ليش ما يستوي ليي وكله يطلع ليي ارر رغم اني كاتبته صح ..؟؟
 
سلااام .....

هذا المثال في الكتاب ..

PHP:
#include<iostream>
using namespace std;
const int ARRAY_SIZE=10;
int seqSearch(const int list[], int listLength, int searchItem);
int main()
{
	int intList[ARRAY_SIZE];
	int number;
	int index;
	cout<<"Line 4:Enter"<<ARRAY_SIZE
		<<"integers."<<endl;
	for(index=0;index<ARRAY_SIZE;index++)
		cin>>intList[index];
	cout<<endl;
	cout<<"Line 8:Enter the number to be"
		<<"searched: ";
	cin>>number;
	cout<<endl;
	index=seqSearch(intList,ARRAY_SIZE,number);
	if(index!=-1)
		cout<<"Line 13: "<<number
		<<"is found at position"<<index
		<<endl;
	else 
		cout<<"Line 15: "<<number
		<<"is not in the list."<<endl;
	system("pause");
	return 0;
}

ابي اعرف ليش ما يستوي ليي وكله يطلع ليي ارر رغم اني كاتبته صح ..؟؟

انتي سويتي السؤال بس الفنكشن seqSearch ماكتبتينه تحت ..

PHP:
int seqSearch ( const list [],int listlength,int searchItem)
{
	int loc;
	for (loc=0; loc<listlength; loc++)
		if ( list[loc] == searchItem)
			return loc;

			return -1;
}
 
شكرا عالتوضيح jacksparrow
 
بكرى كويز دكتور رمزي بكون في شنو ؟؟
جبتر 10 كله ؟؟
 
مشكورين على التوضيح الله يعطيكم العافية
اني بستفيد من الشرح حق الكويز باجر
بالتوفيق للجميع
 
والله مادري لين نفسنه او لا
احنا الكويز يوم الاربعاء عدنه
وشكله في جبتر 10
اتوقع اول كويز يكون نفس الشي عند كل الدكاترة فما بالك بدكتور واحد
احنا نهلة عندنا في جبتر 10 بس في السيرج والسورت
 
ياريت تخبرونا شنو يابو ليكم في الكويز ادا قدمتون
احنا ويه مياده والصراحه قالت لينا الجبتر كامل....
 
ياريت تخبرونا شنو يابو ليكم في الكويز ادا قدمتون
احنا ويه مياده والصراحه قالت لينا الجبتر كامل....

اي هذا هو جبتر 10 ما فيه إلا السيرج والسورت
 
انا يدرسني الدكتور نصر الدين حلاام للحين شرحة ممتاز .. وحليو

اييه شرحه اوكييه .. بس اليييوم اكتشفت انه مضييع في برنامج كاتبينه يوم الاربعا .. وفيه اغلاط وآجد .. وقعد يصلحها ليينا !!

واليوم شرح ليينا strucher .. وماستووعبت ولآ شي منه !
 
هذا اسايمنت وحليته بس عندي غلط ... ياريت احد اساعدني وقولي شنو الاخطاء الى عندي

السؤال

Write a function named insertzeros that takes as parameters : an array of integers , number of elements in the array which is passed by reference , a position in the array pos , an integer NB ( the number of zeros to be inserted ) , and a constant array SIZE ( maximum size ) . The function should insert NB zeros starting from pos.
the function prototype is :

void insertzeros ( int arr [], int & length , int pos , int NB , const int SIZE );

PHP:
void insertzeros ( int arr[],int & length, int pos, int NB, const int size )
{

int i,pos,size;
if ( length < size )
{

for ( i=o; i<NB; i++)
if ( arr[i] > NB)
pos = i;

for ( i=length; i>pos; i--)
length++
arr[pos] = NB

}
 
write a function named SORTBETWEEN that takes any arry of integers INTLIST,index of the first element FIRST and index of the last elemant LAST
the fnuction should sort the values in the arry between FIRST and LAST in decending order(from hlgh to low) use bubble sort

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

بليز حق بكرة اسلمه

ضروري الاي يعرف شنو المطلوب

لايبخل علينا
 
هذا اسايمنت وحليته بس عندي غلط ... ياريت احد اساعدني وقولي شنو الاخطاء الى عندي

السؤال

Write a function named insertzeros that takes as parameters : an array of integers , number of elements in the array which is passed by reference , a position in the array pos , an integer NB ( the number of zeros to be inserted ) , and a constant array SIZE ( maximum size ) . The function should insert NB zeros starting from pos.
the function prototype is :

void insertzeros ( int arr [], int & length , int pos , int NB , const int SIZE );

PHP:
void insertzeros ( int arr[],int & length, int pos, int NB, const int size )
{

int i,pos,size;
if ( length < size )
{

for ( i=o; i<NB; i++)
if ( arr[i] > NB)
pos = i;

for ( i=length; i>pos; i--)
length++
arr[pos] = NB

}


السلام

في بعض الأخطاء و هذي الفنكشن الصح

void insertzeros (int arr[],int &length,int pos,int NB,const int SIZE)
{
if (length==SIZE)
{cout<<"Sorry array is fall"<<endl;
return;
}


for(int j=0;j<NB;j++)
{

for (int i=length;i>=pos;i--)
{
arr=arr[i-1];
}
arr=0;
length++;
}
 
write a function named SORTBETWEEN that takes any arry of integers INTLIST,index of the first element FIRST and index of the last elemant LAST
the fnuction should sort the values in the arry between FIRST and LAST in decending order(from hlgh to low) use bubble sort

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

بليز حق بكرة اسلمه

ضروري الاي يعرف شنو المطلوب

لايبخل علينا

هني تسوي فكشن تاخذ اريه بس ...
وتحط فيها سي ان < حق رقمين
واحد منهم لاست وواحد منهم فيرست
بحيث تحدد رقمين
كمثال
لين الأريه عدنه
2 3 6 0 5 2 7
واخترت الفيرست 2 والاست 5
فالفنكشن بتشوف الارقام الي بين موقع 2 وموقع 5 وبترتبهم تنازلي
يعني في هالمثال بصير جذي >>
2 3 0 6 5 2 7
فبروح بشوف الارقام الي بين الموقع 2 والموقع 5
الي هم
6 0
وبرتبهم تنازلي
من جذي بدل هالرقمين بس وصارو
0 6

وطبعا استخدم مثل ما قال الببل سورت
 
موفقين​
 
التعديل الأخير:
عندي خلل في الاسايمنت ارجو انكم تساعدوني ضروري ابيه حق باجر

و هذا السؤال

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

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

0 1 2 3 4 5 6 7 8 9 10 11 12

2 5 7 20 21 30 35 56 80 86 196 270


2+5 < 20 20+21>30 21+30>35 . . .


PHP:
#include<iostream>
using namespace std;
void insertSum(int arr[], int & length, const int Size)
{
    const int size=15;
     int pos,newitem;
    if(length<size // length<0)
    {
        int sum;
        for(int i=size-2;i<length;i++)
            sum=arr[i]+arr[i+1];
            if(sum<arr[i+2])
        {
            pos=i;
            break;
        }
        for(int j=length-3;j>=pos;j--)
        list[j+2]=list[j+1];
        list[pos]=newitem;
        length++;

      if else
            return false;
    }
                             
}
 
ممكن تساعدوني
عندي اشوي خلل بس ما ادري في وين :RpS_crying:

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);


وهذا الحل الي سويته


#include<iostream>
using namespace std;
void shifttoright(int arr[],int size, int pos){
int i;
for(i=size-2;i>=pos;i--)

arr[i+1]=arr;
}
void insertSum(int arr[], int & length, const int size)
{
int i;
int sum;
sum =arr+arr[i+1];
for(i=0;i<size;i++)
if(sum<arr[i+2])
shifttoright(arr,length,i);
arr=sum;
length++;
}
int main()
{
const int size=15;
int length=10 ;
int arr[15]={2,5,20,21,30,35,80,86,110,270};
cout<<"original array"<<endl;
for(int i=0;i<size;i++)
cout<<arr<<endl;
insertSum(arr,length,size);
cout<<"after calling the function"<<endl;
for(int i=0;i<size;i++)
cout<<arr<<endl;
return 0;
}


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

ممكن تشوفون لي وين الخلل:RpS_unsure:
​

ضروري ابغيه اليوم


الفانكشن عندش غلط
والمين مايحتاج كل الي مسوتنه >>> عندي الحل اذا رجعت البيت بحطه
 
عودة
أعلى أسفل