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

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

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

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

شلونكم شعب

اني بسكشن 7 مع دكتوره نهله هههه ادري متاخره بس توني داخله

بس ماعليكم امر باجر علي كويز في جبتر 10 واني كنت غايبه يوم تشرحه احد يعطيني الاشياء الي يتناولها هالجبتر مع شرح مبسط

ادا ماعليكم امر
 
شلونكم شعب

اني بسكشن 7 مع دكتوره نهله هههه ادري متاخره بس توني داخله

بس ماعليكم امر باجر علي كويز في جبتر 10 واني كنت غايبه يوم تشرحه احد يعطيني الاشياء الي يتناولها هالجبتر مع شرح مبسط

ادا ماعليكم امر

من جد قطعتيلي قلبي ربي يوفقش عيوني :99:

هذا رابط شرح بايربوينت انشاء الله يفيدش شرح بسيط عن شبتر 10
https://www.uob-bh.com/upload/do.php?id=6448
 
التعديل الأخير:
ممكن مساعده في حل الاسايمنت :smile2: :#
Chap11_HW


  1. Add to the program of your previous lab a new struct called TimeType with 2 members (hour and minute).


  1. Redefine the struct called lecture with the following:
    1. CC: Course code(type string)
    2. SN: Section number(type int)
    3. NBS: NB of student in the section(type int)
    4. LT: lecture time (type TimeType)
    5. IDS[40]: list of the students registered in the section.


Part B)

  1. Rewrite a function named Readlecture that takes a parameter a variable LECT of type lecture The function should read all data of NBLEC.
void Readlecture(lecture &LECT);


  1. Rewrite a function named Printlecture that takes as parameter a variable LECT of type lecture The function should output all data of the lecture.
void Printlecture(lecture LECT);


Part C)

Write a main function that do the following:

  1. Declare an array of type lecture maximum size (10) called L[10].
  2. Read the following data into array L.
  3. Print lectures starting at 08:00 clock.



​
واكون شاكره لكم :smile:
 
^^
حاولي بالأول
وهذي مساعده ، اجابة Part A
PHP:
struct TimeType {
int hour;
int minute;
};


struct lecture {
       string CC;
       int SN;
       int NBS;
       TimeType LT;
       long IDS[40];
};
 
  • Like
التفاعلات: the
Write a function named insertNewElement that takes four parameters: an array of integers (List), an integer (newItem), the number of elements in the array (Length), and the maximum size of the array (Max_Size). Assume that the elements in the array are sorted in ascending order. The function should add newItem in a way that the element in the array will remain sorted. Note that the Length of the array should not exceed Max_Size, i.e. if List is full, then the insertion is not performed and an appropriate message is displayed.

هذا السؤال ما عرفت احله، ممكن شرح للشروط اللي راح احتاجها بالـloop
 
Write a function named insertNewElement that takes four parameters: an array of integers (List), an integer (newItem), the number of elements in the array (Length), and the maximum size of the array (Max_Size). Assume that the elements in the array are sorted in ascending order. The function should add newItem in a way that the element in the array will remain sorted. Note that the Length of the array should not exceed Max_Size, i.e. if List is full, then the insertion is not performed and an appropriate message is displayed.

هذا السؤال ما عرفت احله، ممكن شرح للشروط اللي راح احتاجها بالـloop
افرض الأراي مرتبه
لازم نضيف newItem بحيث تبقى الأراي Sorted
يعني شرطنا بيكون
PHP:
if(A[i] > newItem)

من يوصل يحقق الشرط ، يسوي Shift لليمين وبعدها يسوي insert لل newItem
و يسوي
PHP:
 length++;
قبل هذا كله الشرط الأساسي
length<MAXSIZE


سهل ان شاء الله
نسألكم الدعاء
 
^^
حاولي بالأول
وهذي مساعده ، اجابة Part A
PHP:
struct TimeType {
int hour;
int minute;
};


struct lecture {
       string CC;
       int SN;
       int NBS;
       TimeType LT;
       long IDS[40];
};

شكراً ... بارت A مايباله شي لاكن مشكلتي مع بارت B :RpS_crying: مافهمتنه شكله معقد او انا المعقدة :sad_1:
 
ههه أدري مايبي له شي
ابي اشوف شغلش أول
لان الهدف من الموضوع الاستفاده
 
بالأنتظار :)

ع فكره في Part B
يبي نطبع المحاضره اللي تبدأ الساعه 8 بالضبط
يعني مايبي اللي ازيد من ال8 مثل 9 او 10
انا هذا اللي فهمته وكتبت عليه الكود

 
viod clocktype:: settime(int H, int M, int S){
if (H>=0&& H< 24) hr=H;
else
hr=0;
if(M>=0 && M<60) min= H; else min=0;
if(s>=0 && <60) sec= 5; els sec=0;}
void clocktype::gettime(int & M, int & S)
{
H=h; M=main; S=sec;
{

void clocktype::printtine(){
if (hr<10) cout<<0;
cout<<hr<<':';
if ( min<10) cout<<0;
cou<<main<<':';
if(sec< 10) cout<<0;
cout<<sec;
}
viod main(){
clocktype TS6,Tss;
TS6,sttine(8,0,0);
int X,Y,Z;
cout<<"enter time for sec5";
cin>>X>>Y>>Z;
TSS.setime(X,Y,Z);


هذا الي اعرفه بليييززز ساعدوني باقي ساعتين على التسليم :RpS_crying: اخي ITCS Student وينك:tears:
​
 
اللي قدموا كوز 2 جبتر 10 عند أمل الغانم وش جابو ليكم تكتبون برنامج أو اوت بوت
اللي قدمه يجاوب ضروري :99:
 
الكوز كان عبارة عن كتابة function تضيف رقم قبل اول 0 بالـarray
 
بخصوص الكوز : الفكشن بتكون بدون مين :rolleyes2:
 
CHAP11 HW2A) Add to the program of your previous lab a new struct called DateType with 3 members (day, month and year). B) Redefine the struct bookType to hold the following information about a book: a. Title (string),b. up to four authors (array of strings),c. number of authors(string),d. price (float),e. number of copies in stock(int).f. Publication Date(DateType). C) Rewrite the function called ReadOnebook.D) Rewrite the function called OutputOnebook..E) Rewrite the function outofstock that receives an array of struct bookType and outputs Tiles of books with 0 copies in stock . Use same main function:Example of data:​
[TABLE="class: MsoTableGrid, width: 497"]
[TR]
[TD="width: 67, bgcolor: transparent"]
Title​
[/TD]
[TD="width: 156, bgcolor: transparent, colspan: 4"]
Authors​
[/TD]
[TD="width: 96, bgcolor: transparent"]
Nb authors​
[/TD]
[TD="width: 54, bgcolor: transparent"]
price​
[/TD]
[TD="width: 228, bgcolor: transparent, colspan: 3"]
Publication Date​
[/TD]
[TD="width: 62, bgcolor: transparent"]
Nb copies​
[/TD]
[/TR]
[TR]
[TD="width: 37, bgcolor: transparent"]
1​
[/TD]
[TD="width: 37, bgcolor: transparent"]
2​
[/TD]
[TD="width: 39, bgcolor: transparent"]
3​
[/TD]
[TD="width: 42, bgcolor: transparent"]
4​
[/TD]
[TD="width: 75, bgcolor: transparent"]
day​
[/TD]
[TD="width: 72, bgcolor: transparent"]
month​
[/TD]
[TD="width: 81, bgcolor: transparent"]
year​
[/TD]
[/TR]
[TR]
[TD="width: 67, bgcolor: transparent"]
AAA​
[/TD]
[TD="width: 37, bgcolor: transparent"]
A1​
[/TD]
[TD="width: 37, bgcolor: transparent"]
A2​
[/TD]
[TD="width: 39, bgcolor: transparent"]
A3​
[/TD]
[TD="width: 42, bgcolor: transparent"]
A4​
[/TD]
[TD="width: 96, bgcolor: transparent"]
3​
[/TD]
[TD="width: 54, bgcolor: transparent"]
10.5​
[/TD]
[TD="width: 75, bgcolor: transparent"]
12​
[/TD]
[TD="width: 72, bgcolor: transparent"]
11​
[/TD]
[TD="width: 81, bgcolor: transparent"]
2004​
[/TD]
[TD="width: 62, bgcolor: transparent"]
0​
[/TD]
[/TR]
[TR]
[TD="width: 67, bgcolor: transparent"]
BBB​
[/TD]
[TD="width: 37, bgcolor: transparent"]
B1​
[/TD]
[TD="width: 37, bgcolor: transparent"]
B2​
[/TD]
[TD="width: 39, bgcolor: transparent"]
B3​
[/TD]
[TD="width: 42, bgcolor: transparent"]
B4​
[/TD]
[TD="width: 96, bgcolor: transparent"]
1​
[/TD]
[TD="width: 54, bgcolor: transparent"]
25.0​
[/TD]
[TD="width: 75, bgcolor: transparent"]
1​
[/TD]
[TD="width: 72, bgcolor: transparent"]
12​
[/TD]
[TD="width: 81, bgcolor: transparent"]
1999​
[/TD]
[TD="width: 62, bgcolor: transparent"]
55​
[/TD]
[/TR]
[TR]
[TD="width: 67, bgcolor: transparent"]
CCC​
[/TD]
[TD="width: 37, bgcolor: transparent"]
C1​
[/TD]
[TD="width: 37, bgcolor: transparent"]
C2​
[/TD]
[TD="width: 39, bgcolor: transparent"]
C3​
[/TD]
[TD="width: 42, bgcolor: transparent"]
C4​
[/TD]
[TD="width: 96, bgcolor: transparent"]
2​
[/TD]
[TD="width: 54, bgcolor: transparent"]
5​
[/TD]
[TD="width: 75, bgcolor: transparent"]
3​
[/TD]
[TD="width: 72, bgcolor: transparent"]
7​
[/TD]
[TD="width: 81, bgcolor: transparent"]
2011​
[/TD]
[TD="width: 62, bgcolor: transparent"]
0​
[/TD]
[/TR]
[/TABLE]


احد عنده فكرة عن حل هالاسايمنت :RpS_crying: صعب
 
سلام عليكم ..
بغيت أسألكم ..
جم هوم اسايمنت راح ينقبل
لأني طرشته اول امس و ما جيكتنه !
و اليوم جيكته الا متروس ايرور !!
و مابي أخسر درجاتي:tears:
 
شنو يطلع لي خطئين مادري شنو

error C2065: 'intlist' : undeclared identifier

'last' : undeclared identifier
كود:
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]# include
[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] [/SIZE][/B][SIZE=2][/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]<iostream>[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]using
[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] [/SIZE][/B][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]namespace[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] std;[/SIZE][/B]
[B][SIZE=2]
[/SIZE][/B][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int
[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] maxpostion([/SIZE][/B][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] intlist[], [/SIZE][/B][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] last)[/SIZE][/B]
[B][SIZE=2]
[/SIZE][/B][SIZE=2]{

[B]	
[/B][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] max=intlist[0];[/SIZE][/B]
[B][SIZE=2]
	
[/SIZE][/B][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]for[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] i=1; i<last; i++)[/SIZE][/B]
[B][SIZE=2]
		
[/SIZE][/B][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](max<intlist[i])[/SIZE]
[SIZE=2]
[B]		{

			max=intlist[i];

			
[/B][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] location=i;[/SIZE][/B]
[B][SIZE=2]
			
[/SIZE][/B][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] location;[/SIZE][/B]
[B][SIZE=2]
		}

[/SIZE][/B][SIZE=2]}

[B]		
[/B][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] selectionsort([/SIZE][/B][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] list[], [/SIZE][/B][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] size)[/SIZE][/B]
[B][SIZE=2]
		{

			
[/SIZE][/B][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]for[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] i=size ; i>0 ; i--)[/SIZE][/B]
[B][SIZE=2]
			{

				
[/SIZE][/B][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] maxloc=maxpostion(intlist,last);[/SIZE][/B]
[B][SIZE=2]
				
[/SIZE][/B][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] temp=list[maxloc];[/SIZE][/B]
[B][SIZE=2]
				list[maxloc]=list[size];

				list[size]=temp;

				size--;

			}

		}

		
[/SIZE][/B][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] main()[/SIZE][/B]
[B][SIZE=2]
		{

			
[/SIZE][/B][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] intlist[]={2,7,20,90,500,66};[/SIZE][/B]
[B][SIZE=2]
			selectionsort(intlist,6);

			cout << 
[/SIZE][/B][SIZE=2][/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"After sorting , the elemnts are:\n"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2]
[B]			
[/B][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]for[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] j=0 ; j<6 ; j++)[/SIZE][/B]
[B][SIZE=2]
				cout << intlist[j] << 
[/SIZE][/B][SIZE=2][/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]" "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2]
[B]			cout << endl;

			
[/B][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] 0;[/SIZE][/B]
[B][SIZE=2]
		}

[/SIZE][/B][SIZE=2][/SIZE]
 
ممكن شرح chapter8: string type و chapter10: applications of arrays (searching and sorting)z
واذا بالامكان شرح مفصل ماعليكم امر :RpS_scared:
 
ممكن شرح chapter8: string type و chapter10: applications of arrays (searching and sorting)z
واذا بالامكان شرح مفصل ماعليكم امر :RpS_scared:
الstring شرحته قبل ، ابحثي في الصفحات الأولى
ch10 شرحته منه شوي ، عموماً هو شبه حفظ
 
شنو يطلع لي خطئين مادري شنو

error C2065: 'intlist' : undeclared identifier

'last' : undeclared identifier
كود:
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]# include
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]<iostream>[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]using
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]namespace[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] std;[/SIZE][/B]
[B][SIZE=2]
[/SIZE][/B][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int
[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] maxpostion([/SIZE][/B][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] intlist[], [/SIZE][/B][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] last)[/SIZE][/B]
[B][SIZE=2]
[/SIZE][/B][SIZE=2]{

[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] max=intlist[0];[/SIZE][/B]
[B][SIZE=2]
    
[/SIZE][/B][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]for[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] i=1; i<last; i++)[/SIZE][/B]
[B][SIZE=2]
        
[/SIZE][/B][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](max<intlist[i])[/SIZE]
[SIZE=2]
[B]        {

            max=intlist[i];

            
[/B][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] location=i;[/SIZE][/B]
[B][SIZE=2]
            
[/SIZE][/B][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] location;[/SIZE][/B]
[B][SIZE=2]
        }

[/SIZE][/B][SIZE=2]}

[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] selectionsort([/SIZE][/B][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] list[], [/SIZE][/B][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] size)[/SIZE][/B]
[B][SIZE=2]
        {

            
[/SIZE][/B][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]for[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] i=size ; i>0 ; i--)[/SIZE][/B]
[B][SIZE=2]
            {

                
[/SIZE][/B][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] maxloc=maxpostion(intlist,last);[/SIZE][/B]
[B][SIZE=2]
                
[/SIZE][/B][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] temp=list[maxloc];[/SIZE][/B]
[B][SIZE=2]
                list[maxloc]=list[size];

                list[size]=temp;

                size--;

            }

        }

        
[/SIZE][/B][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] main()[/SIZE][/B]
[B][SIZE=2]
        {

            
[/SIZE][/B][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] intlist[]={2,7,20,90,500,66};[/SIZE][/B]
[B][SIZE=2]
            selectionsort(intlist,6);

            cout << 
[/SIZE][/B][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"After sorting , the elemnts are:\n"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2]
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]for[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] j=0 ; j<6 ; j++)[/SIZE][/B]
[B][SIZE=2]
                cout << intlist[j] << 
[/SIZE][/B][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]" "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2]
[B]            cout << endl;

            
[/B][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2] 0;[/SIZE][/B]
[B][SIZE=2]
        }

[/SIZE][/B]

الحين يشتغل بدون اخطاء
لكن عندك اخطاء في السورت (ماعدلتها)
PHP:
# include<iostream>

using namespace std;

int maxpostion(int intlist[], int last)

{

int max=intlist[0];
    int location;
for(int i=1; i<last; i++)
        
if(max<intlist[i])
        {
            max=intlist[i];
location=i;


        }
return location;
}

        
void selectionsort(int list[], int size)

        {

            
for(int i=size ; i>0 ; i--)

            {

                
int maxloc=maxpostion(list,size);

                
int temp=list[maxloc];

                list[maxloc]=list[size];

                list[size]=temp;

                size--;

            }

        }

        
int main()

        {

            
int intlist[6]={2,7,20,90,500,66};

            selectionsort(intlist,6);

            cout <<"After sorting , the elemnts are:\n";

            
for(int j=0 ; j<6 ; j++)

                cout << intlist[j] << " ";

            cout << endl;

system("pause");            
return 0;

        }

return location;
مكانها كان غلط

والfunction اللي ترجع location مو مستخدمنها في الmain
 
عودة
أعلى أسفل