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

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

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

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

الميدتيرم تاريخ 22
في جبتر 10+11+12
- Arrays
- Structs
- Class

مين كتب محاضره اليوم احطها لينا ؟
 
اليوم رمزي يشرح ولا يديري وين الله حاطنه

ينط من موضوع الى موضوع ويفتح كيرلي براكت ولا يصكها و و و

وحتى ماكلف على روحه يقرا اسئلة التتوريال قبل ما يجي

حاسة اني بنسحب
 
المادة كلش سهلة و ما يسوى الواحد ينسحب منها ...

--------------

بما ان اجلو امتحاني الي المفروض الخميس لبعد العيد و اليوم الي حضرو طلبو ان تكون في محاضرة ثانية الأربعاء عشان اكمل حل اسئلة الامتحانات

بكون في محاضرة يوم الأربعاء :smile:
 
انشالله خير

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

ينزلها لينا رحم الله والديه ، باجر عندنا كويز

بعد التحرير:

احد يشرح لينا الـ static in the class
 
التعديل الأخير:
سلام ...
أرجو المساعدة من الجميع في حل هالاسايمنت

هذا السؤال

Records (struct)

Part (A)
Define a struct named courseType, which has four components: courseName and courseCode of type string, courseCredit of type int, and numSections of type int (numSections is between 1 and 12) to represent number of sections allowed for this course.
Part (B)
Using the struct defined in (A). Write a program that reads courses codes followed by their names , credits and number sections from a file. The program should then print the courses in ascending order based on number of sections. Suppose that the department has 20 courses. Use an array of 20 components of type courseType.
Your program should perform the required operations using the following functions:
a. A function to read the courses data into the array. The function prototype is:
void getData(courseType List[], int listSize);

b. A function to sort the array data based on number of sections. The function prototype is: void sortList(courseType List[], int listSize);

c. A function to print the data in the array into a file. The function prototype is:
void printResult(const courseType sList[], int listSize);

------------
وهذا الحل ...

#include<iostream>
#include<fstream>
#include<string>
#include<iomanip>
using namespace std;

struct courseType{
string courseName,courseCode ;
int courseCredit , numSections ;
};
const int size=20;
void getData(courseType list[],int size)
{
ifstream infile;
infile.open("sec.txt");
if(!infile)
cout<<"No file found";
int s;
for(int i=0;i<size;i++)
{

infile>>list.courseName>>list.courseCode
>>list.courseCredit>>s;
if(s<0||s>12)
cout<<"invalid numSections"<<endl;
else
list.numSections=s;
infile.close();
}
}

void sortList(courseType list[], int listSize)
{
courseType temp;
for (int i=1;i<size;i++)
{
for (int j=0;j<size-i;j++)
if(list[j].numSections>list[j+1].numSections)
{
temp=list[j];
list[j]=list[j+1];
list[j+1]=temp;
}
}
}

void printResult(const courseType sList[], int listSize)
{
ofstream outfile;
outfile.open("sec.txt");
for(int i=0;i<listSize;i++)
{
outfile<<sList.courseName<<sList.courseCode
<<sList.courseCredit<<sList.numSections;
}
}
int main()
{

courseType list [20];
getData(list,20);
sortList(list,20);
printResult(list,20);

system("pause");
return 0;

}
 
عبير ادا ماعليج امر حطي لنا اجوبه الورقه الى حلتينها اليوم

:RpS_laugh: اني حليتها وياكم في المحاضرة ما حليتها بروحي ... بس اذا من اليوم محد نزل الحل برد اكتبه و بنزله

شعب احد عنده ورقت التتوريال مالت الكلاس ؟

ينزلها لينا رحم الله والديه ، باجر عندنا كويز

بعد التحرير:

احد يشرح لينا الـ static in the class

التيتوريال كامل موجود في المكتبة الجامعية هو نفسه مال هالسنة
 
انا بسوي سكان للحل لين صار عندي وقت وبحطه
 
[IMGL]https://www.uob-bh.com/upload/up_live/12886942471.jpg[/IMGL]

:shiny: دي لو الثانيه اللي فيها الoutput?
:mellow:
 
وين الاسايمنت الى حلتونا مال الدكتوره مياده ؟ :nosweat:
 
سلام ...

بالنسبة للي حضروا اليوم سكشن سي اس 102 s40-2088

عبير البنفسج سألت عن المتطوع ... شكله ما في ! :nosweat:

على العموم انا بحل السؤال وبنزله بعدين :shiny:
 
هذي ورقة السؤال ...

http://img840.imageshack.us/img840/1947/picture001fe.jpg

وهذا الحل ...

http://img253.imageshack.us/img253/3264/picture002rt.jpg
http://img703.imageshack.us/img703/79/picture003a.jpg

بس فيه خطئين عندي لان كتبتهم بسرعة ... :nosweat:

أول ورقة ... تعريف الستركجر ... آخر شي نسيت أحط ( ; ):nosweat:
وثاني ورقة ... تعريف الستركجر ... آخر شي نسيت القوس والفاصلة ( ;{ ) :RpS_scared:
وآخر الورقة ... نسيت اصك القوس مال الفنكشن :RpS_wink:


مسامحة ... :RpS_tongue:

دعواتكم ... :blushing:
 
في ملاحظة حبيت اقولها :-

اسئلة الفنكشنز تنحل بعدة طرق مو بس الطريقة الي حليت فيها فمن جذي اذا حلاها وياكم الدكتور ممكن يحلها بطريقة ثانية

:rolleyes2: بس اني فضلت اعطيكم مجرد الحل البسيط و ما بغيت اخربطكم في اكثر من حل
 
مشكور حبيب قلبي كتكوت الجامعه ويعطيك العافيه
 
خلاص مافيه محاضرات لا :RpS_tongue:
 
:RpS_tongue: امبلااااااااااااااااااااااا يوم الجمعه الفجر
 
ابغى مساعده في حل هذا السؤال

Records (struct)

Part (A)
Define a struct named courseType, which has four components: courseName and courseCode of type string, courseCredit of type int, and numSections of type int (numSections is between 1 and 12) to represent number of sections allowed for this course.
Part (B)
Using the struct defined in (A).
Write a program that reads courses names followed by their codes, credits and number sections from a file. The program should then print the courses in ascending order based on number of sections. Suppose that the department has 20 courses. Use an array of 20 components of type courseType.
Your program should perform the required operations using the following functions:
a. A function to read the courses data into the array. The function prototype is:
void getData(courseType List[], int listSize);

b. A function to sort the array data based on number of sections. The function prototype is: void sortList(courseType List[], int listSize);

c. A function to print the data in the array into a file. The function prototype is:
void printResult(const courseType sList[], int listSize);
[/B]
 
هذي ورقة السؤال ...

http://img840.imageshack.us/img840/1947/picture001fe.jpg

وهذا الحل ...

http://img253.imageshack.us/img253/3264/picture002rt.jpg
http://img703.imageshack.us/img703/79/picture003a.jpg

بس فيه خطئين عندي لان كتبتهم بسرعة ... :nosweat:

أول ورقة ... تعريف الستركجر ... آخر شي نسيت أحط ( ; ):nosweat:
وثاني ورقة ... تعريف الستركجر ... آخر شي نسيت القوس والفاصلة ( ;{ ) :RpS_scared:
وآخر الورقة ... نسيت اصك القوس مال الفنكشن :RpS_wink:


مسامحة ... :RpS_tongue:

دعواتكم ... :blushing:

يعطيك العافية ..
 
عودة
أعلى أسفل