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

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

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

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

إجابة صحيحة .. :smile2:
بالنسبة للمصفوفة ما يصير نخلي حجمها متغير مثل :

[list[
x لازم يكون عدد أو ثابت ...= const x
والسؤال طالب برنامج عشان نختبر الإجابة فمايضر لو حطينا أرقام من عندنا ..
:rolleyes2:

مثل الأسايمنت مالنا .. :RpS_lol:


يعني ما افهمت وين لازم نحط انو x ثابت..؟؟
 
Write a C++ program that includes the following functions:(1) A function named sortList that takes as parameters: an array of double and the array size. The function should sort the numbers in a descending order. Use selection sort algorithm.(2) A function named readList that takes as parameters: an array of double and the array size. The function should prompt the user to input the array data.(3) A function named printList that takes as parameters: an array of double and the array size. The function should display the elements of the array.

ممكن تشرحولي الالمطلوب والسؤال؟؟
 
Write a C++ program that includes the following functions:(1)A function named sortList that takes as parameters: an array of double and the array size. The function should sort the numbers in a descending order. Use selection sort algorithm.(2)A function named readList that takes as parameters: an array of double and the array size. The function should prompt the user to input the array data.(3)A function named printList that takes as parameters: an array of double and the array size. The function should display the elements of the array.

ممكن تشرحولي الالمطلوب والسؤال؟؟

1- دالة ترتب الأرقام تنازلي ..
كود:
void sortlist (double x[],int y)

2- دالة تقرأ الأرقام ..
كود:
void readList (double x[],int y)

3- دالة لطباعة محتوى المصفوفة على الشاشة ..
كود:
void printList (double x[],int y)

طبعا نوعية المصفوفة "
double " .. بعدين برنامج عشان يتأكد من الدوال ... :smile2:
 
Write a function named SortBetweenthat takes an array of integers intList,index of the first element first andthe index of the last element last.The function should sort the values in the array between first and last inascending order (from low to high) (Useselection sort).write a program to test your function ,, هذا سؤال من الاسايمنت بتاعنا :nosweat: عاد كاتبين تحت ان لازم يسوي return اني سويته void ويطلع صح وكل ما اجرب اسوي return يطلع لي ال output غلط ابي احد شاطر يعدل عليه و يحط ليي ال return :smile2: وشكرا
HTML:
#include<iostream>
using namespace std;
void sortbetween(int list[],int first,int last)
{
	int minindex,temp;
	
		for (int i=first;i<=last;i++)
		{
			minindex=i;
		for (int j=i+1;j<=last;j++)
			if (list[j]<list[minindex])
				minindex=j;
				temp=list[i];
				list[i]=list[minindex];
				list[minindex]=temp;
 
		}
}
int main()
{
	int list[10];
	int first,last;
	for (int i=0;i<10;i++)
	{
		cout<<"Enter an element :";
		cin>>list[i];
		cout<<" ";
	}
	cout<<endl;
	cout<<"Enter the first position uou want to sort :";
	cin>>first;
	cout<<endl;
	cout<<"Enter the last position you want to sort :";
	cin>>last;
	cout<<endl;
 
	sortbetween(list,first,last);
	for (int i=0;i<10;i++)
	cout<<list[i]<<" ";
	cout<<endl;
	return 0;
}
 
Write a function named SortBetweenthat takes an array of integers intList,index of the first element first andthe index of the last element last.The function should sort the values in the array between first and last inascending order (from low to high) (Useselection sort).write a program to test your function ,, هذا سؤال من الاسايمنت بتاعنا :nosweat: عاد كاتبين تحت ان لازم يسوي return اني سويته void ويطلع صح وكل ما اجرب اسوي return يطلع لي ال output غلط ابي احد شاطر يعدل عليه و يحط ليي ال return :smile2: وشكرا
HTML:
#include<iostream>
using namespace std;
void sortbetween(int list[],int first,int last)
{
    int minindex,temp;
    
        for (int i=first;i<=last;i++)
        {
            minindex=i;
        for (int j=i+1;j<=last;j++)
            if (list[j]<list[minindex])
                minindex=j;
                temp=list[i];
                list[i]=list[minindex];
                list[minindex]=temp;
 
        }
}
int main()
{
    int list[10];
    int first,last;
    for (int i=0;i<10;i++)
    {
        cout<<"Enter an element :";
        cin>>list[i];
        cout<<" ";
    }
    cout<<endl;
    cout<<"Enter the first position uou want to sort :";
    cin>>first;
    cout<<endl;
    cout<<"Enter the last position you want to sort :";
    cin>>last;
    cout<<endl;
 
    sortbetween(list,first,last);
    for (int i=0;i<10;i++)
    cout<<list[i]<<" ";
    cout<<endl;
    return 0;
}

إذا ممكن سدح السؤال كامل هني .. :nosweat:
 
-


write a program to read 10 names from file "names.dat" and print thier name length to file " namelength.dat".
In addition print the maximum and minimum length on screen.



حليت هذا السؤال بس البرنامج مو موجود عندي عشان اتأكد والتسليم باجر

جان زين أحد يتأكد لي

( جفت السؤال بالصفحات السابقه بس طريقته غير عني !! )

HTML:
# include <iostram>
# include <fstream>
#include <string>
using namespace std ; 
int main ()
{

string name ; 
int x, max=0 , min=0 ; 

ifstream fin ; 
ofstram fout ; 
fin.open("names.dat");
fout.open("namelength.dat");

while(fin) {
for(int i=0 ; i<10 ; i++)
{ fin>>name ;
x=name.length();
fout<<x;

if(x>max) max=x ; 
if(x<min) min=x;  }


}

cout<<"The  maximum length is : "<<max<<endl;
cout<<"The  minimum length  is : "<<min<<endl;

fin.close();
fout.close();

return 0 ; 


}


أتمنى أحد يجكه وإذا في اخطاء يقول لي
 
-


write a program to read 10 names from file "names.dat" and print thier name length to file " namelength.dat".
In addition print the maximum and minimum length on screen.



حليت هذا السؤال بس البرنامج مو موجود عندي عشان اتأكد والتسليم باجر

جان زين أحد يتأكد لي

( جفت السؤال بالصفحات السابقه بس طريقته غير عني !! )

HTML:
# include <iostram>
# include <fstream>
#include <string>
using namespace std ; 
int main ()
{

string name ; 
int x, max=0 , min=0 ; 

ifstream fin ; 
ofstram fout ; 
fin.open("names.dat");
fout.open("namelength.dat");

while(fin) {
for(int i=0 ; i<10 ; i++)
{ fin>>name ;
x=name.length();
fout<<x;

if(x>max) max=x ; 
if(x<min) min=x;  }


}

cout<<"The  maximum length is : "<<max<<endl;
cout<<"The  minimum length  is : "<<min<<endl;

fin.close();
fout.close();

return 0 ; 


}


أتمنى أحد يجكه وإذا في اخطاء يقول لي

فيه كم حاجه غلط عدلتها ..

كود:
#include <iostream>
#include <fstream>
#include <string>
using namespace std ; 
int main ()
{

    string name ; 
    int x, max=0 , min=100 ;
    ifstream fin ;
    ofstream fout ;
    fin.open("names.dat");
    fout.open("namelength.dat");
    if(fin)
        for(int i=0 ; i<10 ; i++)
        { 
            fin>>name ;
            x=name.length();
            fout<<x<<endl;
            if(x>max) max=x ; 
            if(x<min) min=x;
        }
    cout<<"The  maximum length is : "<<max<<endl;
    cout<<"The  minimum length  is : "<<min<<endl;
    fin.close();
    fout.close();
    return 0 ; 
}
 
سكشن دكتورة نهله ويش سويتون ف الكويز :tongue343: :bleh:
 
احد اشوف ذا البرنامج يطلع كل شيء اوكي بس تطلع ارقام محد يدري بهم من وين (بعد الجواب او اخر اوت بوت ) :whistling: :whistling:



write a function that insert zero before the maixmum elemots



PHP:
    #include <iostream>
using namespace std;
void insZERO (int list[], int &len)
{
int max=0, posmax=0;
for (int i=0; i<len; i++)
{if (list[i]>max)
{max=list[i];
posmax=i;}
}
for (int i=len; i>posmax; i--)
{
list[i]=list[i-1];
list[posmax]=list[posmax];
len++;
}
list[posmax]=0;
}
int main()
{
int list[100], size;
cout<<"enter the size of your list"<<endl;
cin>>size;
cout<<"enter your list"<<endl;
for (int i=0; i<size; i++)
{cin>>list[i];}
cout<<"your list first \n";
for (int i=0; i<size; i++)
{cout<<list[i]<<" ";}
insZERO (list, size);
cout<<"your list after isert \n";
for (int i=0; i<size; i++)
{cout<<list[i]<<" ";}
cout<<endl;
return 0;
}
 
احد اشوف ذا البرنامج يطلع كل شيء اوكي بس تطلع ارقام محد يدري بهم من وين (بعد الجواب او اخر اوت بوت ) :whistling: :whistling:



write a function that insert zero before the maixmum elemots



PHP:
    #include <iostream>
using namespace std;
void insZERO (int list[], int &len)
{
int max=0, posmax=0;
for (int i=0; i<len; i++)
{if (list[i]>max)
{max=list[i];
posmax=i;}
}
for (int i=len; i>posmax; i--)
{
list[i]=list[i-1];
list[posmax]=list[posmax];
len++;
}
list[posmax]=0;
}
int main()
{
int list[100], size;
cout<<"enter the size of your list"<<endl;
cin>>size;
cout<<"enter your list"<<endl;
for (int i=0; i<size; i++)
{cin>>list[i];}
cout<<"your list first \n";
for (int i=0; i<size; i++)
{cout<<list[i]<<" ";}
insZERO (list, size);
cout<<"your list after isert \n";
for (int i=0; i<size; i++)
{cout<<list[i]<<" ";}
cout<<endl;
return 0;
}

جرب هذي الفنكشن .. :smile2:

كود:
void insZERO (int list[], int len)
{
    int max=0, posmax=0;
    for (int i=0; i<len; i++)
        if (list[i]>max)
           {max=list[i];posmax=i;}
    for (int i=len; i>=posmax; i--)
        list[i+1]=list[i];
    list[posmax]=0;
}

وعدل الـ" main " ..
كود:
cout<<"\nyour list after isert \n";
for (int i=0; i<size[COLOR=#b22222]+1[/COLOR]; i++)
 
فيه كم حاجه غلط عدلتها ..

كود:
#include <iostream>
#include <fstream>
#include <string>
using namespace std ; 
int main ()
{

    string name ; 
    int x, max=0 , min=100 ;
    ifstream fin ;
    ofstream fout ;
    fin.open("names.dat");
    fout.open("namelength.dat");
    if(fin)
        for(int i=0 ; i<10 ; i++)
        { 
            fin>>name ;
            x=name.length();
            fout<<x<<endl;
            if(x>max) max=x ; 
            if(x<min) min=x;
        }
    cout<<"The  maximum length is : "<<max<<endl;
    cout<<"The  minimum length  is : "<<min<<endl;
    fin.close();
    fout.close();
    return 0 ; 
}



مشكووور

يعني بهالشكل البرنامج يشتغل نفس السؤال ؟!
 
مشكووور

يعني بهالشكل البرنامج يشتغل نفس السؤال ؟!

هذا البرنامج أحسن .. :smile2:

كود:
#include <iostream>
#include <fstream>
#include <string>
using namespace std ; 
int main ()
{


    string name ; 
    int x, max=0 , min=100 ;
    ifstream fin ;
    ofstream fout ;
    fin.open("names.dat");
    fout.open("namelength.dat");
    if(!fin){cout<<"Erorr no file .. ";return -1;}
    for(int i=0 ; i<10 ; i++)
    { 
        fin>>name ;
        x=name.length();
        fout<<x<<endl;
        if(x>max) max=x ; 
        if(x<min) min=x;
    }
    cout<<"The  maximum length is : "<<max<<endl;
    cout<<"The  minimum length  is : "<<min<<endl;
    fin.close();
    fout.close();
    system("pause");
    return 0 ; 
}
 
هذا البرنامج أحسن .. :smile2:

كود:
#include <iostream>
#include <fstream>
#include <string>
using namespace std ; 
int main ()
{


    string name ; 
    int x, max=0 , min=100 ;
    ifstream fin ;
    ofstream fout ;
    fin.open("names.dat");
    fout.open("namelength.dat");
    if(!fin){cout<<"Erorr no file .. ";return -1;}
    for(int i=0 ; i<10 ; i++)
    { 
        fin>>name ;
        x=name.length();
        fout<<x<<endl;
        if(x>max) max=x ; 
        if(x<min) min=x;
    }
    cout<<"The  maximum length is : "<<max<<endl;
    cout<<"The  minimum length  is : "<<min<<endl;
    fin.close();
    fout.close();
    system("pause");
    return 0 ; 
}



انزين شنو فايدة ذي الجمله

system("pause");
 
انزين شنو فايدة ذي الجمله

system("pause");

اذا كنتي تستخدمين الفيجوال مالها داعي

اذا ما تستخدمينه تحتاجين تكتبينها قبل الreturn

اذا ماكتبتينها وشغلتي البرنامج ، مباشره تختفي السكرين
 
سكشن دكتورة نهله ويش سويتون ف الكويز :tongue343: :bleh:




في حدى بيقدم بالجو الرائع مع الغبره والهوا الي رح يطير كل شي وما بدو يعمل منيح..:whistling:
من كتر ما هو الجو منيح الواحد حل السؤال ع السريع بثواني.. هههههههههههههههه
 
اذا كنتي تستخدمين الفيجوال مالها داعي

اذا ما تستخدمينه تحتاجين تكتبينها قبل الreturn

اذا ماكتبتينها وشغلتي البرنامج ، مباشره تختفي السكرين



أهآآ
أشوا :rolleyes2:


مشكور
 
عدلته :bleh: :bleh: :RpS_lol:

غيرت مكان len++ بس :smile2:
PHP:
#include <iostream>
using namespace std;
void insZERO (int list[], int &len)
{
int max=0, posmax=0;
for (int i=0; i<len; i++)
{if (list[i]>max)
{max=list[i];
posmax=i;}
}
for (int i=len; i>posmax; i--)
{
list[i]=list[i-1];
list[posmax]=list[posmax];

}
list[posmax]=0;
len++;
}


int main()
{
int list[100], size;
cout<<"enter the size of your list"<<endl;
cin>>size;
cout<<"enter your list"<<endl;
for (int i=0; i<size; i++)
{cin>>list[i];}
cout<<"your list first \n";
for (int i=0; i<size; i++)
{cout<<list[i]<<" ";}
insZERO (list, size);
cout<<"\n your list after isert \n";
for (int i=0; i<size; i++)
{cout<<list[i]<<" ";}
cout<<endl;
return 0;
}

جرب هذي الفنكشن .. :smile2:

كود:
void insZERO (int list[], int len)
{
    int max=0, posmax=0;
    for (int i=0; i<len; i++)
        if (list[i]>max)
           {max=list[i];posmax=i;}
    for (int i=len; i>=posmax; i--)
        list[i+1]=list[i];
    list[posmax]=0;
}

وعدل الـ" main " ..
كود:
cout<<"\nyour list after isert \n";
for (int i=0; i<size[COLOR=#b22222]+1[/COLOR]; i++)
 
ممكن احد يحل لي ذي السؤال ضروري !!
Write a function named maxPosition that takes an array of integers intList, and the
The index of the last element in the array(last). The function should return the Position (Location) of the
maximum value in the array (a number between 0 and last).
For example, if the following array intList :
​

[TD="align: left"]25
[/TD]
[TD="align: left"] 99
[/TD]
[TD="align: left"]35
[/TD]
[TD="align: left"]40
[/TD]
[TD="align: left"]45
[/TD]
[TD="align: left"]50
[/TD]
[TD="align: left"] 55
[/TD]
[TD="align: left"] 888
[/TD]
[TD="align: left"] 65
[/TD]
[TD="align: left"] 70
[/TD]
is called with the value of last as 9 it should return 7,
but if it is called with the value of last as 6 it should return 1.

PARTD
Use the above function of part C to write a selectionsort function to sort an array of integers in
descending order (High to low).​
 
عودة
أعلى أسفل