Jump to content
منتدى البحرين اليوم

.-.المواضيـــع المتعلقــة بمقررITCS102.-.


Recommended Posts

بسم الله الرحمن الرحيم

 

فتحتـ لكم موضوعـ جديد لهذه السنة

 

منـ خلالـ هالموضوعـ يمكنكم مناقشة جميعـ المواضيع المتعلقة

 

 

بمقرر cs102 ، ويمكنكم الاستفسار عن جميع ما يتعلق بهالمقرر، من اسايمنتات..واختبارات..شروحـ..الخ..

 

ويمكنكم الأستفادة من الموضوع السابق

من خلالـ هذه الوصلة :smile:

 

اضغطوا هنــــــا

 

موفقين انشاء الله

 

 

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 35
  • Created
  • Last Reply

Top Posters In This Topic

write a program that sorts two arrays parallel, one includes students IDs and the other includes their names using the selection sort.

 

Note: sort the two arrays according to students IDs

 

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

وشكرا مقدما

Link to comment
Share on other sites

بل محد ساعدني بس معليه

 

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

 

وهذي الحل::

 

 

#include <iostream>

#include <string>

using namespace std;

int main()

{

int size=10;

int i,j,min_index;

long IDs[10],temp1;

string names[10], temp2;

 

for(i=0; i<size-1; i++){

min_index=i;

 

for(j=i; j<size; j++)

if(IDs[j]< IDs[min_index])

min_index=j;

temp1=IDs[min_index];

IDs[min_index]=IDs;

IDs=temp1;

temp2=names[min_index];

names[min_index]=names;

names=temp2;

 

}

return 0;

}

Link to comment
Share on other sites

قوه ...... انا عندي اسايمنت 2 احد يبيه اذا تبونه بنزله مع الحل بس ردوو علي وانزله لكم
Link to comment
Share on other sites

من عيوني ماطلبتي وهذي الحل:: (انشالله ماتأخرت عليج)

 

 

#include <iostream>

using namespace std;

 

const size=20;

 

void insertNewElement(int arr[], int newElement, int &length);

 

void main( )

{

int list={1,2,3,4,5,6,8,9,10,11|}

int size=10;

int newElement;

 

cout<<" please enter value";

cin>>newElement;

 

insertNewElement(list,newElement, size);

}

 

void insertNewElement(int arr[], int newElement, int &length){

 

int i=0,j;

bool found= true;

 

whilel(i<length && found)

{

if (arr>newElement)

{

for(j=length;j>i;j--)

{

arr[j]=arr[j-1];

}

arr=nweElement;

length++;

found=false;

}

i++;

}

}

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...