شيئية OOP
281 subscribers
53 photos
10 files
12 links
عمي رحمة لوالديك ولعشيرتك وللعزاز وللعراق وللشرق الأوسط، لا تكعد تحفظ الأكواد
الكود فهم فهم فهم مو حفظ
و السلام
Download Telegram
اسئلة فاينل الهياكل OOP بتاريخ :
2024/5/22
💔14🤓4😨42
شيئية OOP
Photo
Q1/
1-Instance
2-Blueprint
3-Alias
4-Nullptr
5-Overloading
6-early binding
7-Abstraction
8-abstract data type
9-encapsulation
10-problem
2👍2💔2
شيئية OOP
Photo
Q2/

A/
#include<iostream>
using namespace std;
class Rectangle
{
protected:
double lenght,width;
public:
Rectangle(double l,double w):lenght(l),width(w){}
};

class cuboid : public Rectangle
{
double height;
public:
cuboid(double l,double w,double h):Rectangle(l,w),height(h){}
void volume()
{
cout<<"area of cuboid : "<<lenght*width*height<<endl;
}
};

int main()
{
cuboid r(2.2,10.5,5.2);
r.volume();
}


B/
#include<iostream>
using namespace std;

class Cars {
private:
string brandN;
int maxspeed, fuelC, safetyR;
public:
Cars(string b,int m,int f,int s):brandN(b),maxspeed(m),fuelC(f),safetyR(s){}
bool operator>(const Cars& other) const {
int pointA=0, pointB=0;
if (maxspeed>other.maxspeed) {
pointA++;
} else {
pointB++;
}
if (fuelC<other.fuelC) {
pointA++;
} else {
pointB++;
}
if (safetyR>other.safetyR) {
pointA++;
} else {
pointB++;
}
return pointA > pointB;
}
};

int main() {
Cars BMW("BMW",300,5,10);
Cars KIA("KIA",200,4,5);
if(BMW > KIA) {
cout <<"BMW has a higher assessment"<< endl;
}else{
cout <<"KIA has a higher assessment"<< endl;
}
return 0;
}
4❤‍🔥4💊3👍1
شيئية OOP
Photo
Q3/

A/
#include<iostream>
using namespace std;
class Item
{
protected:
string title,author;
int ISBN;
public:
Item(string t,string a,int i):title(t),author(a),ISBN(i){}
virtual void buy(bool p){
cout << "the virtual function" << endl;
}
};
class Book : public Item
{
public:
Book(string t,string a,int i):Item(t,a,i){}
void buy(bool p)
{
if(p)
{
cout<<title<<" by "<<author<<endl<<"ISBN :"<<ISBN<<endl;
}
else
{
cout<<"book unavailable"<<endl;
}
}
};
class DVD : public Item
{
public:
DVD(string t,string a,int i):Item(t,a,i){}
void buy(bool p)
{
cout<<title<<" by "<<author<<endl<<"ISBN :"<<ISBN<<endl;
}
};
int main() {
Book adeq("legend of zelda","ahmed",503);
DVD n("mario songs","marimaker",163);
Item* ptr;

ptr=&adeq;
ptr->buy(true);

ptr=&n;
ptr->buy(0);
}


B/
#include<iostream>
#include<stdexcept>
using namespace std;
class nuclear_reactor
{
protected:
int temperature,pressure;
double radiation_levels;
public:
nuclear_reactor(int t,int p,double r):temperature(t),pressure(p),radiation_levels(r){}

};
class monitoring : public nuclear_reactor
{
public:
monitoring(int t,int p,double r):nuclear_reactor(t,p,r){}
void checktemp()
{
if(temperature>1000)
{
throw "temperature is too high";
}
else cout<<"temperature is normal"<<endl;
}
void checkpressure(){
if (pressure>2000)
{
throw"pressure is too high";
}
else cout<<"pressure is normal"<<endl;
}
void checkrad() {
if (radiation_levels>0.1)
{
throw"high radiation";
}
else cout<<"normal radiation"<<endl;
}
};
int main() {
monitoring a(1100,1700,0.03);
monitoring b(900,1500,0.02);
try{
a.checktemp();
a.checkpressure();
a.checkrad();
}catch(const char* msg)
{
cerr<<msg <<endl;
}
try{
b.checktemp();
b.checkpressure();
b.checkrad();
}catch(const char* msg)
{
cerr<<msg <<endl;
}

}
6
الحل مقدم من أحد الطلبة 〔 〕
3
ملاحظة/
الاسئلة تنحل بأكثر من طريقة
لذلك كل شخص و طريقته و تكون صحيحة ان شاء الله
مو شرط نفس الطريقة
5
البرمجة :

ملزمة دفعة²⁵ + حلول الواجبات:
https://t.me/Q_code_cpp/311


شروحات:
شرح كامل للغة Cpp من الصفر:
https://youtube.com/playlist?list=PLEPx7DrqAqKAJm4wM3r7FvvX7y6tuBOAQ&si=moNpvaL7IPGRFJv8

شرح المتسلسلة سؤال 31:
https://t.me/no_zero_any_more/359
طريقة عمل اللوب باستخدام الفنكشن فقط:
https://t.me/no_zero_any_more/360
سؤال سلسلة تايلور للساين:
https://t.me/no_zero_any_more/362
انواع الفنكشن الاربع:
https://t.me/no_zero_any_more/364
شرح سؤال 74 مهم جداً:
https://t.me/no_zero_any_more/371
كل العمليات الرياضية والمنطقية الي بل برمجة:
https://t.me/no_zero_any_more/373
شرح سؤال 51:
https://t.me/no_zero_any_more/379

الفيديوهات على اليوتيوب:
https://www.youtube.com/channel/UCQCagTCsQ2eIYYCPOCngTIQ/

الأكواد 75 سؤال:
الاسئلة الـ 75:
https://t.me/Q_code_cpp/308

الـ 75 كاملة بحل أحد الطلبة:
https://t.me/Q_code_cpp/266

بطريقة حلي:
من هذا الرابط لحد سؤال 50 فقط:
https://t.me/Q_code_cpp/2
سؤال 51:
https://t.me/Q_code_cpp/58
سؤال 52:
https://t.me/Q_code_cpp/59

اسئلة عن الـ Function:
https://t.me/Q_code_cpp/56
https://t.me/Q_code_cpp/57

اسئلة الـ Array:
https://t.me/no_zero_any_more/326

قوانين رياضية بصيغ برمجية:
https://t.me/no_zero_any_more/345

اسئلة المد:
https://t.me/Q_code_cpp/268
اسئلة الفاينل:
https://t.me/Q_code_cpp/270
اسئلة المحاولة الثانية:
https://t.me/Q_code_cpp/281
حل اسئلة المحاولة الثانية:
https://t.me/Q_code_cpp/290
https://t.me/Q_code_cpp/291
https://t.me/Q_code_cpp/294

الدور الأول²⁰²⁵:
https://t.me/Q_code_cpp/318
حل اسئلة الدور الأول²⁰²⁵:
https://t.me/Q_code_cpp/321

الدور الثاني²⁰²⁵:
https://t.me/Q_code_cpp/333
2
75 c++ exercises.cpp
55.9 KB
75 c++ exercises.cpp
👍2
اسئلة المد / البرمجة وحل المشاكل
ملاحظة/
سؤال 1، هذا حفظ من الفصل الأول يولي حذفه

شرح العمليات المنطقية :
https://t.me/no_zero_any_more/373

Q2 /
1) 6 ( هاي شفت العنصر مرتين بجهة اليمين ( ال y = 25 بالباينري 11001 تشفتها مرتين تصير 00110 = 6 )

2) 20
هاي مقارنة بين البتات هيج تصير
x = 1101 , y = 11001
نساوي بينهن
x = 01101
y = 11001
هسه نقارن مرتبة الx ويه الy واذا متشابهات الناتج صفر و اذا مختلفات الناتج واحد
ف تصير 10100 وهاي تساوي 20

3) 1 ( ويعني true لان يكلك x لا يساوي y وهذا صحيح لان x = 13 و y = 25 )

Q3 /
1- sizeof
2- Bool
3- operating system
👍1
اسئلة الفاينل / البرمجة وحل المشاكل

شرح العمليات المنطقية :
https://t.me/no_zero_any_more/373

Q1 /
A -
1) 16 ( لان عملية ناقص - - بجهة اليمين ف ما تشتغل )
2) 1 ( يعني true لان عملية جمع منطقية بوابة OR )
3) 0 ( يعني false لان مقارنة هاي اذا x يساوي y وهن غير متساويات)
4) 2 ( ناتج القسمة لان y/x = 16/8 و ناتجها 2 )
5) 4 ( هاي شفت العنصر مرة واحدة بجهة اليمين ( موضوع اللوجك بالكورس الثاني التشفيت) بالباينري 8 = 1000 ، شفت مرة وحدة تصير 0100 = 4 )

B -

1- relational operator ( ص26 )
2- logical operator ( ص28 )
3- ^=
موجود بـ ( ص29)
4- break
5- end
1👍1
الهياكل OOP :

شروحات :
في نهاية القائمة ( بوينتر، رفرنس، ستركت، Inline ) :
https://youtube.com/playlist?list=PLCInYL3l2AajFAiw4s1U4QbGszcQ-rAb3&si=3vYmdgld5-Dwv_UF

شرح لـ OOP :
https://youtube.com/playlist?list=PLCInYL3l2Aaiq1oLvi9TlWtArJyAuCVow&si=RPVhIKrXhbp-a8Il

بنهاية هاي القائمة موجود شرح عن OOP
من فيديو 131:
https://youtube.com/playlist?list=PLEPx7DrqAqKAJm4wM3r7FvvX7y6tuBOAQ&si=moNpvaL7IPGRFJv8


الحفظيات :
https://t.me/Q_code_cpp/243

حلول الـ Exercises الـ 18 سؤال :
https://t.me/Q_code_cpp/141
اسئلة المختبر :
المختبر الأول : ( كان من الملزمة بوينتر ، رفرنس ، ستركتر ) .
المختبر الثاني :
https://t.me/Q_code_cpp/69
المختبر الثالث :
https://t.me/no_zero_any_more/949
المختبر الرابع :
https://t.me/Q_code_cpp/90
المختبر الخامس :
https://t.me/Q_code_cpp/163
المختبر السادس :
https://t.me/Q_code_cpp/174
المختبر السابع :
https://t.me/Q_code_cpp/186

الكوز الأول :
https://t.me/Q_code_cpp/67
الكوز الثاني :
https://t.me/Q_code_cpp/197

اسئلة المد + الحل :
https://t.me/Q_code_cpp/180
مِد 2025:
https://t.me/Q_code_cpp/323

بالنسبة لمد المختبر فكان من ال18 سؤال .

اسئلة الفاينل + الحل :
https://t.me/Q_code_cpp/257

الدور الأول²⁰²⁵:
https://t.me/Q_code_cpp/331

الدور الثاني:
https://t.me/Q_code_cpp/298
حل الدور الثاني:
https://t.me/Q_code_cpp/301
https://t.me/Q_code_cpp/302

الدور الثاني²⁰²⁵:
https://t.me/Q_code_cpp/335

فاينل المختبر :
https://t.me/Q_code_cpp/212
حلول :
https://t.me/Q_code_cpp/214
https://t.me/Q_code_cpp/215

بعض الأمثلة من عندي الي شفت الدكتور تكلم عنها او لمح لها :
https://t.me/Q_code_cpp/168
https://t.me/Q_code_cpp/218
https://t.me/Q_code_cpp/251
اسئلة البرمجة / المحاولة الثانية
👌3😡3👎1🤩1👨‍💻1
شيئية OOP
Photo
Q1 /
A-
1) 21
2) 1
3) 1
4) 8
5) 48

B-
1- relational
2- logical
3- ( &= )
4- continue
5- beginning

ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

Q2/
A - يشبه سؤال 2
#include <iostream>
using namespace std;

int main()
{
    int a = 5, b = 10;
    cout << "Before swapping: a = " << a << ", b = " << b << endl;

    a = a + b;
    b = a - b;
    a = a - b;

    cout << "After swapping: a = " << a << ", b = " << b << endl;

    return 0;
}

B - سؤال 4
#include <iostream>
using namespace std;

int main()
{
float sum=0;
float average;
float number [6];
cout<< " enter the six number : "<<endl;
for (int i = 0; i < 6; i++)
{
cout<<" number "<<i+1<<" : ";
cin>>number[i];
sum += number[i];
average = sum/6;
}
cout<<" the sum "<<sum<<endl;
cout<<" the average "<<average<<endl;
return 0;
}

ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

Q3/
A - 6 سؤال
#include <iostream>
using namespace std;
int main ()
{
int a = 11;
while ( a <= 29)
{
cout<<a<<", ";
a += 2;
}
return 0;
}

B - سؤال 16
#include <iostream> 
using namespace std;

int main()
{
char character;

cout << "Enter a character: ";
cin >> character;

if ((character >= 'a' && character <= 'z') || (character >= 'A' && character <= 'Z'))
{
switch (character)
{
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':
cout << character << " is a vowel." << endl;
break;
default:
cout << character << " is a consonant." << endl;
}
}
else
{
cout << "Invalid input. Please enter a valid alphabet character." << endl;
}

return 0;
}
2
شيئية OOP
Photo
Q4/
A -
#include <iostream>
using namespace std;

int fun(int a)
{
return a;
}

int main() {
cout<<fun(5);
}

👇همين يعتبر حل حبيته هيج :
#include <iostream>
using namespace std;

string fun(string a ) {
return a;
}

int main() {
cout<<fun( " نجحنا واليحبنا يفرح ويانا ");
}


B - سؤال 33
#include <iostream>
using namespace std;
int main ()
{
char grade ;
cout << " take one from this ( A , B, C, D, F) ";
cin >> grade;
switch(grade)
{
case 'A' :
cout << "Excellent!" << endl;
break;
case 'B' :
cout << "Well done" << endl;
break;
case 'C' :
cout << "done" << endl;
break;
case 'D' :
cout << "You passed" << endl;
break;
case 'F' :
cout << "Better try again" << endl;
break;
default :
cout << "Invalid grade" << endl;
}
cout << "Your grade is " << grade << endl;
return 0;
}

ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

Q5/
A -
#include<iostream>
using namespace std;

int Sum(int a[],int s)
{
int sum = 0;
for (int i = 0; i < s; i++) {
int current_item = a[i];
bool unique_ = true;
for (int j = 0; j < s; j++) {
if (i != j&&current_item == a[j]) {
unique_ = false;
}
}
if (unique_)sum += a[i];
}
return sum;
}
int main() {
int i[8] = {1,2,3,2,3,4,2,5};
cout << Sum(i,8);
}

B -
#include<iostream>
using namespace std;

double product(int a,double d){
return a*d;
}
int main() {
cout<<(2,1.5);
}

ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

Q6/
A -
#include<iostream>
using namespace std;

int power(int base, int pow) {
if (pow == 0)
return 1;
else if (pow == 1)
return base;
else
return base * power(base, pow - 1);
}

int main() {
cout << power(3, 3);
return 0;
}

B -
#include<iostream> 
using namespace std;

double calculateSin(double x, int n)
{
double result = 0;
double term = 1;
int sign = 1;

for (int i = 1; i <= n; ++i)
{
result += sign * term;
sign = -sign;
term *= (x * x) / ((2 * i) * (2 * i + 1));
}

return result;
}

int main()
{
double x;
int n;

cout << "Enter the value of x in radians: ";
cin >> x;

cout << "Enter the number of terms in the Taylor series approximation: ";
cin >> n;

double sinApproximation = calculateSin(x, n);

cout << "Approximation of sin(" << x << ") using Taylor series with " << n << " terms: " << sinApproximation << endl;

return 0;
}
1
اسئلة الهياكل OOP / الدور الثاني
2