shaico111 commited on
Commit
66432a4
·
verified ·
1 Parent(s): a1a6b40

Upload batch 132/306

Browse files
שנה א/תכנות מונחה עצמים/מעבדה/מעבדה 7/Lab7-8.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:db8085d888db07027bad23cbe9c4b2b7c9cabff8ee5d8e2523b5b64def8b58d6
3
+ size 144007
שנה א/תכנות מונחה עצמים/מעבדה/מעבדה 7/Lab7.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ca5c596662eca19ae22f65d974fbee1d9d921b855a9073c07abb3152f5bb0b1
3
+ size 138646
שנה א/תכנות מונחה עצמים/מעבדה/מעבדה 7/פתרון חלקי למעבדה 07-08-20241023/CellPhones.cpp ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include "CellPhones.h"
2
+ #include <iostream>
3
+ using namespace std;
4
+
5
+ Type2::Type2(string clock){
6
+ SetClock(clock);
7
+ }
8
+
9
+ void Type2::SetClock(string clock){
10
+ this->clock=clock;
11
+ }
12
+
13
+ string Type2::GetClock() const {
14
+ return this->clock;
15
+ }
16
+
17
+ void Type2::IAmIs(){
18
+ cout<< "I am is type 2:\n";
19
+ }
20
+
21
+ Type1::Type1(string clock, int count)
22
+ :Type2(clock){
23
+ this->countPics=(count>0)?count:0;
24
+ }
25
+
26
+ void Type1::SetPics(){
27
+ this->countPics++;
28
+ cout << "make pictures\n";
29
+ }
30
+
31
+ int Type1::GetPics() const{
32
+ return this->countPics;
33
+ }
34
+
35
+ void Type1::IAmIs(){
36
+ cout<< "I am is type 1:\n";
37
+ }
שנה א/תכנות מונחה עצמים/מעבדה/מעבדה 7/פתרון חלקי למעבדה 07-08-20241023/CellPhones.h ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ #include "Phones.h"
3
+ //#include <string>
4
+ //using namespace std;
5
+
6
+ class Type2: public _phone{
7
+ private:
8
+ string clock;
9
+ public:
10
+ Type2(string);
11
+ void SetClock(string);
12
+ string GetClock() const;
13
+ void IAmIs();
14
+ };
15
+
16
+ class Type1: public Type2{
17
+ private:
18
+ int countPics;
19
+ public:
20
+ Type1(string, int);
21
+ void SetPics();
22
+ int GetPics() const;
23
+ void IAmIs();
24
+ };
שנה א/תכנות מונחה עצמים/מעבדה/מעבדה 7/פתרון חלקי למעבדה 07-08-20241023/Phones.cpp ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <iostream>
2
+ using namespace std;
3
+ #include "Phones.h"
4
+ #include <string>
5
+
6
+ _phone::_phone(){
7
+ countCall=0;
8
+ countRec=0;
9
+ }
10
+
11
+ void _phone::NowCall(const string &pnum){
12
+ if(countCall<10)
13
+ called[countCall++]=pnum;
14
+ else
15
+ insertNumber(called, pnum);
16
+ cout<< "now call : " << called[countCall-1]<<endl;
17
+ }
18
+
19
+ void _phone::NowCall(int i){
20
+ if(i<countCall)
21
+ cout<< "now call : " << called[i]<<endl;
22
+ else
23
+ cout<< "number not set!!"<<endl;
24
+ }
25
+
26
+ void _phone::NowRecive(const string &pnum){
27
+ if(countRec<10)
28
+ called[countRec++]=pnum;
29
+ else
30
+ insertNumber(recived, pnum);
31
+ cout<< "now recive : " << recived[countRec-1]<<endl;
32
+
33
+ }
34
+
35
+ string _phone::LastCalled() const{
36
+ return called[countCall-1];
37
+ }
38
+
39
+ string _phone::LastRecived() const{
40
+ return recived[countRec-1];
41
+ }
42
+
43
+ void _phone::ListCalles() const{
44
+ for(int i=0; i<countCall; i++)
45
+ cout<< called[i] << endl;
46
+ }
47
+
48
+ void _phone::ListReciveds() const{
49
+ for(int i=0; i<countRec; i++)
50
+ cout<< recived[i] << endl;
51
+ }
52
+
53
+ void _phone::insertNumber(string pn[], const string &pnum){
54
+ for(int i=1; i<10; i++)
55
+ pn[i-1]=pn[i];
56
+ pn[9]=pnum;
57
+ }
58
+
59
+ void RegularPhone::IAmIs(){
60
+ cout<<"I am is regulare phone \n";
61
+ }
שנה א/תכנות מונחה עצמים/מעבדה/מעבדה 7/פתרון חלקי למעבדה 07-08-20241023/Phones.h ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ #include <string>
3
+ using namespace std;
4
+
5
+ class _phone{
6
+ private:
7
+ string called[10];// char calles[10][11]
8
+ int countCall;
9
+ string recived[10];
10
+ int countRec;
11
+ void insertNumber(string [], const string &);
12
+
13
+
14
+ public:
15
+ _phone();
16
+ ~_phone(){};
17
+ void NowCall(const string &);
18
+ void NowCall(int );
19
+ void NowRecive(const string &);
20
+ void NowRecive(int );
21
+ string LastCalled() const;
22
+ string LastRecived() const;
23
+ void ListCalles() const;
24
+ void ListReciveds() const;
25
+ virtual void IAmIs()=0;
26
+ };
27
+
28
+ class RegularPhone: public _phone{
29
+ public:
30
+ RegularPhone():_phone(){};
31
+ void IAmIs();
32
+ };
שנה א/תכנות מונחה עצמים/מעבדה/מעבדה 7/פתרון חלקי למעבדה 07-08-20241023/test07.cpp ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <iostream>
2
+ #include <string>
3
+ using namespace std;
4
+ #include "Phones.h"
5
+ #include "CellPhones.h"
6
+
7
+ void main(){
8
+ RegularPhone rph;
9
+ rph.IAmIs();
10
+ rph.NowCall("02-6543217");
11
+ rph.NowCall("02-5432145");
12
+ cout << "Last calles: " << rph.LastCalled() << endl;
13
+ rph.ListCalles();
14
+ system("pause");
15
+ Type2 ct01("12:08:00");
16
+ ct01.IAmIs();
17
+ ct01.NowCall("052-6664455");
18
+ ct01.NowCall("052-5656565");
19
+ cout << "Last calles: " << ct01.LastCalled() << endl;
20
+ cout << "Clock: " <<ct01.GetClock()<<"\n";
21
+ ct01.ListCalles();
22
+ system("pause");
23
+ Type1 ct02("14:10:40", 2);
24
+ ct02.IAmIs();
25
+ ct02.NowCall("054-2224455");
26
+ ct02.NowCall("054-3236565");
27
+ cout << "Last calles: " << ct02.LastCalled() << endl;
28
+ cout << "Clock: " <<ct02.GetClock() << endl;
29
+ ct02.SetPics();
30
+ ct02.SetPics();
31
+ ct02.SetPics();
32
+ cout << "pictures: " << ct02.GetPics()<<"\n";
33
+ ct02.ListCalles();
34
+ system("pause");
35
+ }
שנה א/תכנות מונחה עצמים/מעבדה/מעבדה 9/Lab9.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ee50410f16a9301bcc6596983baf5182e9007b997d0d9403d0292442fdf32903
3
+ size 530668
שנה א/תכנות מונחה עצמים/מעבדה/מעבדה 9/מעבדה 9 - פתרון חלקי (ספיר)-20241023/queue.cpp ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include "queue.h"
2
+ #include <iostream>
3
+
4
+ using namespace std;
5
+ //
6
+ //
7
+ //template <typename T> queue<T>::queue() {
8
+ // int* arr = new int[10];
9
+ // int size = 10;
10
+ // this->createArray(arr, size);
11
+ //}
12
+ //
13
+ //template <typename T> queue<T>::queue(T arr[], int s) {
14
+ //
15
+ //}
16
+ //
17
+ //template <typename T> void queue<T>::createArray(const T arr[], const int size) {
18
+ // this->ptr = new T[size];
19
+ // this->size = size;
20
+ // for (int i = 0; i < size; i++)
21
+ // {
22
+ // this->ptr[i] = arr[i];
23
+ // }
24
+ //}
25
+ //
26
+ //template <typename T> void queue<T>::print() {
27
+ // int i;
28
+ // if (!this->ptr) return;
29
+ // for (i = 0; i < this->size; i++) {
30
+ // cout << this->ptr[i] << " ";
31
+ // }
32
+ // cout << endl;
33
+ //}
שנה א/תכנות מונחה עצמים/מעבדה/מעבדה 9/מעבדה 9 - פתרון חלקי (ספיר)-20241023/queue.h ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ #pragma once
3
+ using namespace std;
4
+ #include <iostream>
5
+ #include <cmath>
6
+ #include <cfloat>
7
+ #include <iomanip>
8
+
9
+
10
+ template<typename T>
11
+ class myType {
12
+
13
+ public:
14
+ string intType;
15
+ string boolType;
16
+ string floatType;
17
+ string stringType;
18
+ string doubleType;
19
+
20
+ myType() {
21
+ intType = typeid(int).name();
22
+ boolType = typeid(bool).name();
23
+ floatType = typeid(float).name();
24
+ stringType = typeid(string).name();
25
+ doubleType = typeid(double).name();
26
+ }
27
+
28
+ string getValueType(T value) {
29
+ return typeid(value).name();
30
+ }
31
+
32
+ };
33
+
34
+ template <typename T>
35
+ class queue
36
+ {
37
+ private:
38
+ T* ptr;
39
+ int size;
40
+ void createArray(const T arr[], const int s);
41
+
42
+ public:
43
+ queue();
44
+ queue(T* arr, int s);
45
+ void print();
46
+ };
47
+
48
+
49
+ template<typename T>
50
+ inline void queue<T>::createArray(const T arr[], const int size)
51
+ {
52
+ this->ptr = new T[size];
53
+ this->size = size;
54
+ for (int i = 0; i < size; i++)
55
+ {
56
+ this->ptr[i] = arr[i];
57
+ }
58
+ }
59
+
60
+ template <typename T> queue<T>::queue() {
61
+ T* arr = new T[10];
62
+ int size = 10;
63
+ this->createArray(arr, size);
64
+ }
65
+
66
+ template <typename T> queue<T>::queue(T* arr, int s) {
67
+ createArray(arr, s);
68
+ }
69
+
70
+
71
+ template <typename T> void queue<T>::print() {
72
+ int i;
73
+ myType<T> t;
74
+ bool addZero;
75
+ T value;
76
+
77
+ if (!this->ptr) return;
78
+
79
+ for (i = 0; i < this->size; i++) {
80
+ value = this->ptr[i];
81
+ string valueType = t.getValueType(value);
82
+ addZero = valueType == t.floatType ||
83
+ valueType == t.doubleType;
84
+ if (addZero)
85
+ if (floor(value) - value == 0)
86
+ cout << value << ".00 ";
87
+ else {
88
+ cout << floor(value) << "."
89
+ //the number after the '.' will be two characters
90
+ << setfill('0') << setw(2)
91
+ /*
92
+ 3.121 - 3 == 0.121
93
+ 0.121*100 == 12.1
94
+ floor(12.1) == 12
95
+ all in all, 3.12
96
+ */
97
+ << floor((value - (int)value) * 100) << " ";
98
+ }
99
+ else if (valueType == t.boolType) {
100
+ string s = value == 1 ? "true" : "false";
101
+ cout << s << " ";
102
+ }
103
+ else cout << this->ptr[i] << " ";
104
+ }
105
+ cout << endl;
106
+ }