شيئية OOP
282 subscribers
53 photos
10 files
12 links
عمي رحمة لوالديك ولعشيرتك وللعزاز وللعراق وللشرق الأوسط، لا تكعد تحفظ الأكواد
الكود فهم فهم فهم مو حفظ
و السلام
Download Telegram
تجمع بؤساء الهندسة²⁴⁻²³
تغيير قيمة المعاملات باستخدام البوينتر : #include <iostream> using namespace std; int p ( int *ptr){ *ptr+= 1; return *ptr; } int main() { int m = 5; cout << p(&m) << endl; cout << m << endl; cout << p(&m) << endl; }
منا وانت نازل مادتنا لهذا الكورس :
أمثلة
الكوز
اسئلة المختبر
ال18 سؤال
اسئلة من العام السابق


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

شرح لـ OOP :
https://youtube.com/playlist?list=PLCInYL3l2Aaiq1oLvi9TlWtArJyAuCVow&si=RPVhIKrXhbp-a8Il
3
شيئية OOP
منا وانت نازل مادتنا لهذا الكورس : أمثلة الكوز اسئلة المختبر ال18 سؤال اسئلة من العام السابق و بالنسبة لشروحات المادة ف اليوتيوب مليئ بالمقاطع تابع الي تفهم عليه +انا ناشر لعادل نسيم : في نهاية القائمة ( بوينتر، رفرنس، ستركت، Inline ) : https://youtub…
#include <iostream>
using namespace std;

class Box {

private:
double length;
double breadth;
double height;

public:
Box(double l, double b, double h) {
length = l;
breadth = b;
height = h;

}

double Volume() {
return length * breadth * height;
}

int compare(Box box) {
return this->Volume() > box.Volume();
}

};


int main(void)
{
Box Box1(3.3, 1.2, 1.5);
Box Box2(8.5, 6.0, 2.0);
if(Box1.compare(Box2)) {
cout << "Box2 is smaller than Box1" <<endl;
}
else {
cout << "Box2 is equal to or larger than Box1" <<endl;
}

return 0;
}

هاي من الملزمة بس اتوقع يجيبها لأن ما طبقناها
👍6
اسئلة mid-term الهياكل الشيئية OOP
بتاريخ :
2024/4/22
شيئية OOP
Photo
السؤال الأول /
1- instance
2- memory
3- name
4- member
5- this ->
6- early
7- virtual , implementation

☆●☆

السؤال الثاني /
#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;
}


☆●☆

السؤال الثالث /
#include<iostream>
using namespace std;
class customer
{
protected:
string name;
int phonenumber;
int credit;
public:
customer(string n,int ph,int c):name(n),phonenumber(ph),credit(c){}
virtual void call() {
cout << " virtual calling " << endl;
};

};
class prepaid : public customer
{
public:
prepaid(string n,int ph,int c):customer(n,ph,c){}
void call() {
cout<<"prepaid make call"<<endl;
}
};
class postpaid : public customer
{
public:
postpaid(string n,int ph,int c):customer(n,ph,c){}
void call()
{
cout<<"postpaid make call"<<endl;
}

};
int main()
{
prepaid call1("memo",3579,300);
postpaid call2("oeom",2468,600);
customer* ptr=&call1;
ptr->call();
ptr=&call2;
ptr->call();
}
👍32
الفراغات ما متأكد منهن 100%
ف يمكن اغيرهن
Forwarded from هندسة حاسبات
Channel name was changed to «شيئية OOP»
هندسة حاسبات
Photo
حل السؤال

#include <iostream>
using namespace std;

class Bank {

public:
double balance;

void deposit(double amount) {
if (amount > 0) {
balance += amount;
}
else {
throw "can't deposit a negtive value";
}
}

void withDrawing(double amount) {
if (balance >= amount) {
balance -= amount;
} else {
throw "can't withDrawing more money than your balance";
}
}

void display() {
cout << "your Balance: " << balance << endl;
}
};

int main() {
Bank s1 = {350};

try {
s1.deposit(-5);
} catch (const char* msg) {
cerr << "Error: " << msg << endl;
}

try {
s1.withDrawing(400);
} catch (const char* msg) {
cerr << "Error: " << msg << endl;
}

s1.display();

return 0;
}
👍63
الدكتور كال السؤال مضمون 100% يجيبه بالفاينل
ف هذا سؤال من اسئلة الفاينل
ادرسوه جيداً💀
هو صح كال راح اجيبه ما ينحل
بس نحاول و الله كريم
🗿7🤣4👍1🔥1
شيئية OOP
سؤال المختبر
جرب تخلي التراي و الcatch بالكلاس
كوز اليوم
بتاريخ : 2024/4/29
👍81
شيئية OOP
كوز اليوم بتاريخ : 2024/4/29
خل اسوي نفس الي يدورون اتنشن

وصلوني 200 لايك و اجيبلكم الحل
👍41🤣4👎3🤡3🗿3💊2😈1
شيئية OOP
كوز اليوم بتاريخ : 2024/4/29
الحل :

#include<iostream>
using namespace std;

class carengine {
public:
virtual void check()=0;
};


class Water : public carengine {
private:
int watertemperature;

public:
Water(int w = 0):watertemperature(w){}

void check()
{
if(watertemperature<30) {
throw "water temperature is too low";
}
else {
cout << "water temperature normal" << endl;
}
}
};


class Oil : public carengine {
private:
int oiltemperature;

public:
Oil(int o = 0):oiltemperature(o){}

void check()
{
if(oiltemperature>75) {
throw "oil temperature is too high";
}
else {
cout << "oil temperature normal" << endl;
}
}
};

int main()
{
Water check1(20);
Oil check2(90);

carengine* eng;

eng = &check1;
try {
eng->check();
} catch(const char* msg) {
cerr << "Note: " << msg << endl;
}

eng = &check2;
try {
eng->check();
} catch(const char* msg) {
cerr << "Note: " << msg << endl;
}

return 0;
}
6❤‍🔥2👍1🌚1
اسئلة فاينل المختبر
مجموعة 1 :
1- بوليمورفزم ( بالملزمة موجود ( شكل ، الريكتانكل ، تراينكل ) ص45-44
2- كاتش وثرو ( القسمة اخر صفحة بالملزمة ) ولكن كلاس

مجموعة 2 :
1- سؤال البنك ( فريند فنكشن ، سكوب ريزلوشن ( : : ) )
2- اوفرلودنك =<

مجموعة 3 :
1- اوفرلودنك جمع بين ابعاد ريكتانكل و كيوبيد
2- بوليمورفزم

مجموعة 4 :
1- كود Class Bank يتضمن موضوع exception handling ( الي هو try , catch , throw )
2-
3👍3
شيئية OOP
اسئلة فاينل المختبر مجموعة 1 : 1- بوليمورفزم ( بالملزمة موجود ( شكل ، الريكتانكل ، تراينكل ) ص45-44 2- كاتش وثرو ( القسمة اخر صفحة بالملزمة ) ولكن كلاس مجموعة 2 : 1- سؤال البنك ( فريند فنكشن ، سكوب ريزلوشن ( : : ) ) 2- اوفرلودنك =< مجموعة 3 : 1- اوفرلودنك…
بخصوص صياغات الاسئلة
كلها موجودة بالقناة
فقط تضع تعديلات بسيطة حسب مفهوم السؤال وهذا شيء بسيط
ف الي يروح فاهم الاكواد الي هنا يجاوب و يطلع مختم المادة ومن الله التوفيق والسداد
5👍1🔥1