هندسة حاسبات
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;
}
👍6❤3
الدكتور كال السؤال مضمون 100% يجيبه بالفاينل
ف هذا سؤال من اسئلة الفاينل
ادرسوه جيداً💀
هو صح كال راح اجيبه ما ينحل
بس نحاول و الله كريم
ف هذا سؤال من اسئلة الفاينل
ادرسوه جيداً💀
هو صح كال راح اجيبه ما ينحل
بس نحاول و الله كريم
🗿7🤣4👍1🔥1
شيئية OOP
#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…
مقارنة اكبر اصغر ( نفس سؤال المد تقريباً بس هذا من الملزمة )
شيئية OOP
كوز اليوم بتاريخ : 2024/4/29
خل اسوي نفس الي يدورون اتنشن
وصلوني 200 لايك و اجيبلكم الحل
وصلوني 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-
مجموعة 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
اوفرلودنك =<
#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() const {
return length * breadth * height;
}
bool operator>=(const Box& box) {
return Volume() >= box.Volume();
}
};
int main()
{
Box Box1(3, 9, 5);
Box Box2(8, 6, 2);
if (Box1 >= Box2) {
cout << "Box1 is equal to or bigger than Box2" << endl;
}
else {
cout << "Box1 is smaller than Box2" << endl;
}
return 0;
}
👍6❤3🔥3
شيئية OOP
اسئلة فاينل المختبر مجموعة 1 : 1- بوليمورفزم ( بالملزمة موجود ( شكل ، الريكتانكل ، تراينكل ) ص45-44 2- كاتش وثرو ( القسمة اخر صفحة بالملزمة ) ولكن كلاس مجموعة 2 : 1- سؤال البنك ( فريند فنكشن ، سكوب ريزلوشن ( : : ) ) 2- اوفرلودنك =< مجموعة 3 : 1- اوفرلودنك…
سؤال القسمة try , catch , throw :
#include <iostream>
using namespace std;
class calc{
private:
int x, y;
public:
calc(int m, int g): x(m), y(g) {}
double addition () {
return x+y;
}
double subtract () {
return x-y;
}
double multiply () {
return x*y;
}
double divide () {
if ( y == 0 ) {
throw "Division by zero condition!";
}
else {
return x/y;
}
}
};
int main() {
calc check(7, 0);
try {
cout << check.divide();
} catch ( const char* msg ) {
cerr << msg << endl;
}
return 0;
}
👍4❤2
شيئية OOP
حل السؤال #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…
مجموعة 4 اسئلة A(1)
نفس هذا
بس الفرق الدكتور يريد فقط withdrawal و تخليها بموضوع try , catch , throw
نفس هذا
بس الفرق الدكتور يريد فقط withdrawal و تخليها بموضوع try , catch , throw
شيئية OOP
Ex4 : Create a class for a bank_account that includes the account_holder's_name, account_number, and balance. Implement member functions for deposit (as member inside the class), withdrawal (as member outside the class), and displaying (as a void friend function)…
سؤال البنك الاعتيادي
مجموعة 2 اسئلة A(1)
مجموعة 2 اسئلة A(1)
هنا صيغة طلب السؤال تكون التعامل مع المشاكل يكون في الكلاس نفسه
#include <iostream>
using namespace std;
class Bank {
public:
double balance;
void deposit(double amount) {
try {
if (amount > 0) {
balance += amount;
} else {
throw "can't deposit a negative value";
}
} catch (const char* msg) {
cerr << "deposit Error: " << msg << endl;
}
}
void withDrawing(double amount) {
try {
if (balance >= amount) {
balance -= amount;
} else {
throw "can't withdraw more money than your balance";
}
} catch (const char* msg) {
cerr << "withdrawal Error: " << msg << endl;
}
}
void display() {
cout << "your balance: " << balance << endl;
}
};
int main() {
Bank s1 = {350};
s1.deposit(-5);
s1.withDrawing(400);
s1.display();
return 0;
}
👍1