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

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

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

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

يا جماعة أريد وصلة لتحميل برنامج ++c
 
عندي اسايمنت بليز ساعدوني

Consider the following class definition:

class Section{ private :
int Sec; //section number.
int count; //number of the students in the section. long *IDs; //IDs of students in the section.
int maxSize // Variable to store the maximum size of ----------------IDs ( students) in the section
public:
Section (const Section & another); Section (int, int ,int);
void addlD(long);
int getCount ( ) ;
void print( ) const;
~Section ( ) ;}
1. Write the definition of class Section (above class) in a header file called “section.h”.
2. Complete the above class by writing the definitions of all member functions in another file (impClass.cpp) and include the header file “section.h”.
a. The Constructor function Section (int, int int) ; initializes the data member Sec , count and maxsize and allocates dynamically one dimensional array pointed by IDs.
b. The Constructor function Section (const Section & another); should copy the content object another to the current object. (copy constructor).
c. The Function addID should add an ID at the end of the array.
d. The function getCount should return the number of students in the section.
e. The function print should prints all students IDs in the section.
f. A Destructor function to destroy all dynamically allocated memory


حليت بس يطلع لي ايرورز
class Section{ private :
int Sec; //section number.
int count; //number of the students in the section.
long *IDs; //IDs of students in the section.
int maxSize // Variable to store the maximum size of ----------------IDs ( students) in the section
public:
Section (const Section & another);
Section (int, int ,int);
void addlD(long);
int getCount ( ) ;
void print( ) const;
~Section ( ) ;
}
#include<iostream>
#include"section.h"
using namespace std;
Section (ints,intc,intms){
Sec=s;
count=c;
maxSize=ms;
IDs=newlong[maxSize];
}
Section (const Section & another){
ms=another.ms;
IDs=newlong[maxSize];
for(inti=0;i<ms;i++)
IDs=another.IDs;
}
void addlD(long){
for(int i=maxSize;i>0;i--)

IDs=IDs[i-1];
maxsize++;
}
int getCount ( ){
return count;
}
void print( ) const{
for(int i=0;i<maxsize;i++)
cout<<IDs<<" "<<endl;
}
~Section ( ){
delete[]IDs;
IDs=NULL;}


#include<iostream>
#include"section.h"
using namespace std;
int main()
{
Section a;
a.Section(const Section & another s1);
a.Section(int s,int c ,int ms);
a.addlD(long id);
a.getCount( );
a.print( )const
system("pause");
return 0;
}
هاي طريقة حلي بس ممكن اتوضحون شنو الغلط فيه

او مشكورين
ناطرة ردودكم
 
هذا الاسايمنت الي عندي اياه سويته كامل صح بس عندي خطوه ناقصه او مو عارفه اضيفها اهي انه لازم اذا دخل اعداد ازيد من الخمسه يطبع لينه the program is terminated
Using the following class definition of a P_Type



class P_Type

{

private:

int maxSize; //variable to store the maximum size of p

int length; //variable to store the number elements in p

int *p; //pointer to an int array

public:

void print() const;

1)Function to output the data stored in the array p.

2)Function to insert num into the array p at the position specified by index.

If index is out of bounds, the program is terminated.

If index is within bounds, but greater than the index of the last item in the list, num is added at the end of the list.

3)Constructor: Creates an array of the size specified by the parameter size; the default array size is 10.

4)Destructor: deallocates the memory space occupied by the array p.

5)Copy constructor



};

A) Implement all member functions of the above class.





B) Write a main function that do the following:

1. Create one object called PT1 with size 5.

2. input 5 integer and store them in PT1 usinginsertAt function

3. Create another object called st2 and initialize it by PT1.

4. Display PT1 and PT2.

​

هذا السؤال
#include <iostream>
#include <assert.h>
using namespace std;
class P_Type
{
private:
int maxsize;
int length;
int *p;
public:
void print() const;
void insertAt(int index,int num);
P_Type(int size=10);
P_Type(const P_Type &otherobject);
~P_Type();
};
void P_Type::print() const {
for(int i=0; i<length; i++)
cout << p << " ";
cout << endl;
}
void P_Type::insertAt(int index,int num)
{
assert(index>=0 && index<maxsize);

p[(index > length)? length : index] = num;

length++;
}
P_Type::P_Type(int size) {
if(size <= 0){
cout << "The array size must be positive" << endl;
cout << "Creating an array of the size 10" << endl;
maxsize = 10;
}
else
maxsize = size;

length=0;
p = new int[maxsize];
}
P_Type::~P_Type() {
delete[] p;
}
P_Type::P_Type(const P_Type &otherobject){

maxsize = otherobject.maxsize;
length = otherobject.length;
p = new int[maxsize];

for(int i=0; i < length; i++)
p = otherobject.p;
}
int main()
{
P_Type PT1(5);
int x;
cout << "Enter 5 integers into PT1: ";
for(int i=0; i<5; i++) {
cin >> x;
PT1.insertAt(i, x);
}
P_Type PT2(PT1);
cout << "\nPT1: ";
PT1.print();
cout << "\nPT2: ";
PT2.print();

cout << endl;
return 0;
}
وهذا الحل واذا فيه غلط ياريت اتخبروني او شكرا
 
يوم الاحد ويه مياده مافيه دوام صح ؟
 
مافي شكن
عند مياده
يوم الاحد:bye1:
 
الاثنين بعد كانه مافيه لا ؟!
 
شعب في اي احد اهني عند دكتورة نهله ؟
 
الله يستر دكتور رمزي اليوم معصبla:21
ما علقوا الدرجات انا رجعت البيت ما ادري؟
 
طنش .. تعش .. تنتعش

:RpS_lol: :RpS_lol:​
 
ههههههههههههههههههههههه
رمزي اليوم
صدق صدق
زفت ابناااااااااااااااااااااااا
هههههههههههههههههههههههههههههههههههههههههههههههههههههههههه

خوفني لاكن
بس درجتي مو سيئة هالقد :p
 
ههههههههههههههههههههههه
رمزي اليوم
صدق صدق
زفت ابناااااااااااااااااااااااا
هههههههههههههههههههههههههههههههههههههههههههههههههههههههههه

خوفني لاكن
بس درجتي مو سيئة هالقد :p

:mellow: حطو الدرجات يعني ؟؟
 
يقولون عند السكرتيره ^^

اليوم على نهاية الدوام بينزلونهم​
 
:RpS_sleep: يلا عجل الي يجوف درجته يبشرنا
 
ههههههههههههههههههههههه
رمزي اليوم
صدق صدق
زفت ابناااااااااااااااااااااااا
هههههههههههههههههههههههههههههههههههههههههههههههههههههههههه

خوفني لاكن
بس درجتي مو سيئة هالقد :p

بس زفت
حسسني الكل جايب صفر في السكشن:RpS_crying:

حطوا الدرجات:RpS_crying:
ما فيني انتظر للاربعاء:tears:
 
الافرج هذه الكورس 25.6 من 60 طبعا
الله يستر من الدرجه
 
محد يتكرم يصورهم ليناا له ؟ دار راسي واني اليوم س 9 لا ويقول بكل ثقة معلقينهم

طلع ما في شي
 
رمزي سكشن 3 شلون كانت الدرجات؟
 
عودة
أعلى أسفل