-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClasswork.cpp
More file actions
61 lines (48 loc) · 1.06 KB
/
Classwork.cpp
File metadata and controls
61 lines (48 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# include <iostream>
using namespace std;
int sub (int x, int y){
return x - y;
}
int sub (double x, double y){
return x - y;
}
struct university{
int room_num = 100;
string room_type = "Lab";
}aau, unity;
template <typename generic1>
generic1 sub1 (generic1 a, generic1 b){
return b - a;
}
namespace name1
{
int a = 45;
int b = 5;
int point() { return a + b; }
}
namespace name2
{
double x = 4;
double y = 7;
double point() { return x*y; }
}
int main(){
cout<< sub(4,2)<<endl;
cout<< sub(8.5, 3.6)<<endl;
aau.room_num = 30;
unity.room_type = "Cafeteria";
university jimma;
jimma.room_num = 300;
jimma.room_type = "Office";
cout<<aau.room_num<<endl;
cout<<unity.room_type<<endl;
cout<<jimma.room_num<<endl;
cout<<jimma.room_type<<endl;
cout<<sub1(2, 18)<<endl;
cout<<sub1(2.5, 80.3)<<endl;
cout << name1::point() << '\n';
cout << name2::point() << '\n';
cout << name2::x << '\n';
}
//What is the difference between struct and class in c++?
//Explore more about struct.