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

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

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

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

السلام عليكم .. شخباركم :blushing:
شخبار الاجازة معاكم اللي باقي لها يوم وتخلص :tears:
المهم بدخل ف الموضوع دايركت .. امممم انا كتبت برنامج بس عندي اغلاط ومو عارفه وين :whistling:
هاذ البرنامج :
كود:
#include <iostream>#include <string>
using namespace std;
struct studenttype
{


    string studentFname , studentLname ;
    int testscore ;
    char grade ;
};
void readdata (studenttype list[],int size);
void assinggrade (studenttype list[],int size);
void findhighesttscore (studenttype list[],int size);
void printdata (studenttype list[],int size);
int main ()
{
    studenttype clas[20];
    readdata (clas , 3);
    assinggrade (clas , 3);
    findhighesttscore (clas , 3);
    printdata (clas , 3 );


    system ("pause");
}
void readdata (studenttype list[],int size)
{
    for (int i=0;i<size;i++)
    {
        cout<<"enter studentFname:"<<endl;
        cin>>list[i].studentFname;
        cout<<"enter studentLname:"<<endl;
        cin>>list[i].studentLname;    
        cout<<"enter student test score:"<<endl;
        cin>>list[i].testscore;
    }
}
void assinggrade (studenttype list[],int size)
{
      char a,b,c,d,f;


      for (int i=0;i<size;i++)
      {
          if (list[i].testscore>=90)
            {
                list[i].grade=a;
          cout<<list[i].studentLname<<","<<" "<<list[i].studentFname<<" "<<list[i].testscore<<" "<<list[i].grade<<endl;
          }
          else if (list[i].testscore>=80)
          {
               list[i].grade=b;
          cout<<list[i].studentLname<<","<<" "<<list[i].studentFname<<" "<<list[i].testscore<<" "<<list[i].grade<<endl;
          }
          else if (list[i].testscore>=70)
          {
               list[i].grade=c;
          cout<<list[i].studentLname<<","<<" "<<list[i].studentFname<<" "<<list[i].testscore<<" "<<list[i].grade<<endl;
          }
          else if (list[i].testscore>=60)
          {
               list[i].grade=d;
          cout<<list[i].studentLname<<","<<" "<<list[i].studentFname<<" "<<list[i].testscore<<" "<<list[i].grade<<endl;
          }
          else 
               list[i].grade=f;
          cout<<list[i].studentLname<<","<<" "<<list[i].studentFname<<" "<<list[i].testscore<<" "<<list[i].grade<<endl;
      }
}
void findhighesttscore (studenttype list[],int size)
{
   int max = 0;
   for ( int i =0;i<size;i++)
   {
       if (list[i].testscore>max)
           max = list[i].testscore;
   }
}
void printdata (studenttype list[],int size)
{
    int max;
     for ( int i =0;i<size;i++)
   {
       if (list[i].testscore==max)
       cout<<list[i].studentLname<<","<<" "<<list[i].studentFname<<endl;
     }
}

الغلط عندج ان تسوين :
PHP:
grade = a;

المفروض تسوين :
PHP:
grade = 'a';

في بعد شغلة لازم ما تنسينها ان انتين مخلية السايز مال الأدري 20 بس قاعدة تتعاملين ويا 3 بس. اعتقد هالشي مسوتنه عمدا عشان تجربين البرنامج بدون ما تدخلين 20, بس هالشي سهل تنسينه و تسلمين الحل غلط :no:
بعد اخر شغلة, انتين في الـ بس قاعدة تطبعين الهايست سكور مو الانفورميشن مال كل الطلاب (ما أدري عمدا أو بالغلط).

ع فكرة بعد يعني ترا الفنكشن اللي توجد أعلى درجة ما منها فايدة. لأن هي بس تحصله و تخليه في فاريبل اسمه max و هالفاريبل بيتمحى بعد ما تخلص الفنكشن. الطريقة الصحيحة (مو الوحيدة بس صحيحة), ان تخلين الفنكشن ترجع انتجر اللي هو رقم الهاليست داخل الأري. جذي يعني :
PHP:
int findhighesttscore(studenttype list[], int size) {	int max = 0;	for (int i = 0; i < size; i++) {		if (list[i].testscore > max)			max = i;	}	return max;}

هذي هي الفنكشن و طريقة استخدامها بتكون شي جذي :
PHP:
int maxIndex = findhighestscore(list,size);
cout<<list[max].name<<" has the highest score"<<endl;

:smile2:
 
السلام عليكم .. شخباركم :blushing:
شخبار الاجازة معاكم اللي باقي لها يوم وتخلص :tears:
المهم بدخل ف الموضوع دايركت .. امممم انا كتبت برنامج بس عندي اغلاط ومو عارفه وين :whistling:
هاذ البرنامج :
كود:
#include <iostream>#include <string>
using namespace std;
struct studenttype
{


    string studentFname , studentLname ;
    int testscore ;
    char grade ;
};
void readdata (studenttype list[],int size);
void assinggrade (studenttype list[],int size);
void findhighesttscore (studenttype list[],int size);
void printdata (studenttype list[],int size);
int main ()
{
    studenttype clas[20];
    readdata (clas , 3);
    assinggrade (clas , 3);
    findhighesttscore (clas , 3);
    printdata (clas , 3 );


    system ("pause");
}
void readdata (studenttype list[],int size)
{
    for (int i=0;i<size;i++)
    {
        cout<<"enter studentFname:"<<endl;
        cin>>list[i].studentFname;
        cout<<"enter studentLname:"<<endl;
        cin>>list[i].studentLname;    
        cout<<"enter student test score:"<<endl;
        cin>>list[i].testscore;
    }
}
void assinggrade (studenttype list[],int size)
{
      char a,b,c,d,f;


      for (int i=0;i<size;i++)
      {
          if (list[i].testscore>=90)
            {
                list[i].grade=a;
          cout<<list[i].studentLname<<","<<" "<<list[i].studentFname<<" "<<list[i].testscore<<" "<<list[i].grade<<endl;
          }
          else if (list[i].testscore>=80)
          {
               list[i].grade=b;
          cout<<list[i].studentLname<<","<<" "<<list[i].studentFname<<" "<<list[i].testscore<<" "<<list[i].grade<<endl;
          }
          else if (list[i].testscore>=70)
          {
               list[i].grade=c;
          cout<<list[i].studentLname<<","<<" "<<list[i].studentFname<<" "<<list[i].testscore<<" "<<list[i].grade<<endl;
          }
          else if (list[i].testscore>=60)
          {
               list[i].grade=d;
          cout<<list[i].studentLname<<","<<" "<<list[i].studentFname<<" "<<list[i].testscore<<" "<<list[i].grade<<endl;
          }
          else 
               list[i].grade=f;
          cout<<list[i].studentLname<<","<<" "<<list[i].studentFname<<" "<<list[i].testscore<<" "<<list[i].grade<<endl;
      }
}
void findhighesttscore (studenttype list[],int size)
{
   int max = 0;
   for ( int i =0;i<size;i++)
   {
       if (list[i].testscore>max)
           max = list[i].testscore;
   }
}
void printdata (studenttype list[],int size)
{
    int max;
     for ( int i =0;i<size;i++)
   {
       if (list[i].testscore==max)
       cout<<list[i].studentLname<<","<<" "<<list[i].studentFname<<endl;
     }
}

في أخطاء في assinggrade ، findhighesttscore ، printdata
إنشاء الله توضح ليكم السالفة .. :smile2:
كود:
void assinggrade (studenttype list[],int size)
{
      for (int i=0;i<size;i++)
	  {
		  if (list[i].testscore>=90)
				list[i].grade='A';
		  else if (list[i].testscore>=80)
			   list[i].grade='B';
		  else if (list[i].testscore>=70)
			   list[i].grade='C';
		  else if (list[i].testscore>=60)
			   list[i].grade='D';
		  else 
			   list[i].grade='F';
	  }
}
void findhighesttscore (studenttype list[],int size)
{
   int max = 0,p=0;
   for ( int i =0;i<size;i++)
   {
	   if (list[i].testscore>max)
	   {
		   max = list[i].testscore;
		   p=i;
	   }
   }
   cout<<"Highest test score for :"<<endl<<list[p].studentFname<<", "<<list[p].studentLname<<endl;
}
void printdata (studenttype list[],int size)
{
	cout<<"All students info. "<<endl;
	 for ( int i =0;i<size;i++)
	 {
	   cout<<list[i].studentFname<<", "<<list[i].studentLname<<" "<<list[i].testscore<<" "<<list[i].grade<<endl;
	 }
}
 
مشكوورين ماقصرتو :blushing: :tears: جد كنت متوهقه فيه !
بس بالنسبة للمعلومات اللي يطبعها , السؤال جذي مشترط يعني مو مني ( مادري هم يبون اطلع معلومات كل طالب بعدين اطلع اسم الطالب اللي حصل اعلى درجة ):nosweat::smile2:
وبالنسبة لسايز الاري (3 ) مجرد تجربة للبرنامج :rolleyes2: .
 
Five-letter word x is hidden in a string y such that the first two letters of x are the first two letters of y and the third letter of x is the middle letter of y and the last two letters of x are the last two letters of y. Note that y is any string with length greater than 5.
For example, the 10-letter string grabcefgat hides the 5-letter word great.
And the 7-letter string enatber hides the 5-letter word enter.
(a) Write a function called extract that takes a string as an input parameter and returns the hidden word.
(b) Write a program that reads a string from the user and displays the hidden word extracted from the entered string using the
function extract

شلون نطلع الميدل حق ال سترنغ :RpS_huh: يعني اذا بنقسم السايز مال ال سترنغ ع 2 بطلع العدد مو INT وفوق هاذ يمكن مايكون الحرف الصح ؟!!!:RpS_blink:
 
Five-letter word x is hidden in a string y such that the first two letters of x are the first two letters of y and the third letter of x is the middle letter of y and the last two letters of x are the last two letters of y. Note that y is any string with length greater than 5.
For example, the 10-letter string grabcefgat hides the 5-letter word great.
And the 7-letter string enatber hides the 5-letter word enter.
(a) Write a function called extract that takes a string as an input parameter and returns the hidden word.
(b) Write a program that reads a string from the user and displays the hidden word extracted from the entered string using the
function extract

شلون نطلع الميدل حق ال سترنغ :RpS_huh: يعني اذا بنقسم السايز مال ال سترنغ ع 2 بطلع العدد مو INT وفوق هاذ يمكن مايكون الحرف الصح ؟!!!:RpS_blink:

إذا قسمتين السايز مال السترنق على 2 بيطلع ليش انتجر. لأن قسمة انتجر(السايز) على انتجر(الاثنين). المشكلة ان لو كان العدد فردي بيعطيش دايما الحرف اللي ع اليسار. يعني لو 11 بيعطيش الحرف الخامس. هذي احسها مشكلة في السؤال نفسه. ع العموم دام السؤال جذي بيكون حله بس ان انتين تقسمين على اثنين (إذا يبي الحرف اللي ع اليمين تقسمين ع اثنين و تزيدين واحد. بس ما اعتقد هذا اللي يبيه).
 
التعديل الأخير:
إذا قسمتين السايز مال السترنق على 2 بيطلع ليش انتجر. لأن قسمة انتجر(السايز) على انتجر(الاثنين). المشكلة ان لو كان العدد فردي بيعطيش دايما الحرف اللي ع اليسار. يعني لو 11 بيعطيش الحرف الخامس. هذي احسها مشكلة في السؤال نفسه. ع العموم دام السؤال جذي بيكون حله بس ان انتين تقسمين على اثنين (إذا يبي الحرف اللي ع اليمين تقسمين ع اثنين و تزيدين واحد. بس ما اعتقد هذا اللي يبيه).

يعني في المثال اللي موجود ف السؤال (الكلمه اللي حاطينها من 7 حروف ) بس الميدل مطلعينه صح ! اصلا احس هالسؤال كله غلط مادري شلون :RpS_unsure: وهالجبتر كامل ماله داعي :RpS_crying:
 
يعني في المثال اللي موجود ف السؤال (الكلمه اللي حاطينها من 7 حروف ) بس الميدل مطلعينه صح ! اصلا احس هالسؤال كله غلط مادري شلون :RpS_unsure: وهالجبتر كامل ماله داعي :RpS_crying:

بسيطة ..
كود:
mid=s.length()/2;
هذا النص ..
كود:
s[mid-1]
وهذا الحرف اللي في النص
لأن في فرق بين الطول و الموقع
:smile2:
 
مرحبا شباب وشابات بليز ساعدوني اللي يعرف الامتحان الساعه كم بكره؟ ووين بكون بالضبط حق سكشن 9 نهلة المرزوقي انتظر ردكم
 
مرحبا شباب وشابات بليز ساعدوني اللي يعرف الامتحان الساعه كم بكره؟ ووين بكون بالضبط حق سكشن 9 نهلة المرزوقي انتظر ردكم
الامتحان بيكون الساعه 11 الى 12:30

روحي كلية الايتي.. معلقين اعلان مكتوب فيه مكان الامتحان لكل سكشن
اعتقد كل السكاشن بيمتحنون في كلية الايتي
بس روحي تاكدي من الصبح وشوفي الاعلان .. او روحي اسالي الدكتورة
 
التعديل الأخير:
لوسمحتوا ممكن شرح لل pointer

وشكرا.......:smile::smile:
 
حليت منه شوي ووقفت في احد يعرف أحله


PART(A)
Implement a class named shoppingList which includes the following data members:
- list: a pointer to string, representing a dynamic array to hold the names of the shopping items.
- maxSize: maximum number of items in the shopping list.
- numItems: the number of items currently in the list.
The class shoppingList contains the following member functions:
A Constructor with default value parameter for maxSize=10. The function should initialize numItems to be zero and create a dynamic array pointed by list of size maxSize.
A copy constructor.
A function named printList to print all the information about shoppingList.
A function named addNewItem which is used to add a new item Y to the end of the list and increment numItems. The function should check first that list is not full and Y is not already in the list.
A Destructor.

PART(B)
In the main function, write C++ statements to:
- Create an object names myList1 of type shoppinglist with size=5;
- Add “Rice” and “Sugar” items to list1.
- Create another object named myList2 and initialize it by using the value of myList1.
- Add “Milk” and “Coffee” to myList2.
- Print the details of myList1 and myList2.

 

PART(A)
Implement a class named shoppingListwhich includes the following data members: - list: a pointer to string, representing a dynamic array to hold the names of the shopping items. - maxSize: maximum number of items in the shopping list. - numItems: the number of items currently in the list. The class shoppingListcontains the following member functions: 1. A Constructor with default value parameter for maxSize=10. The function should initialize numItemsto be zero and create a dynamic array pointed by list of size maxSize. 2. A copy constructor. 3. A function named printListto print all the information about shoppingList. 4. A function named addNewItemwhich is used to add a new item Y to the end of the list and increment numItems. The function should check first that list is not full and Y is not already in the list. 5. A function named isListEmptywhich returns true if list is empty.6. A function named isListFullwhich returns true if list is full. 7. A Destructor. PART(B)In the main function, write C++ statements to:- Create an object names myList1 of type shoppinglist with size=5;- Add “Rice” and “Sugar” items to list1. - Create another object named myList2 and initialize it by using the value of myList1.- Add “Milk” and “Coffee” to myList2.- Print the details of myList1 and myList2.

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

Ev508660.gif
 
مشكور
Ali.4

اشكرك على لمساعده :smile::smile:
 
السلام عليكم ..
عندي استفسار ويآليت تجاوبوني عليه :99:

شلون نتأكد اذا array فل او لا ؟؟ لاحظت هالشرط كثير يتكرر في الاسئلة وابي افهمه :tears:
انا قلت نكتب :
if (list == size) cout<< " array is full
مدري اذا صح او لا :no:
 
السلام عليكم ..
عندي استفسار ويآليت تجاوبوني عليه :99:

شلون نتأكد اذا array فل او لا ؟؟ لاحظت هالشرط كثير يتكرر في الاسئلة وابي افهمه :tears:
انا قلت نكتب :
if (list == size) cout<< " array is full
مدري اذا صح او لا :no:

;if (length > size) cout<<"Array is full"<<endl

 
شسمه ,,
ف احد عنده حل توتوريال 5 و 6 و 7 ؟!!
:blushing:
و شكراً,,
 
عودة
أعلى أسفل