forked from ASD-ADF/ASD_Task_1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
130 lines (120 loc) · 3.4 KB
/
main.cpp
File metadata and controls
130 lines (120 loc) · 3.4 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#include <iostream>
#include "asd_task_1.h"
using namespace std;
string name = "your name here";
string nim = "your id here";
string cls = "your class here";
int main() {
cout << "Hello world!, "<<name
<<",\nid: " << nim
<<"\nfrom " << cls<< endl;
cout<<endl<<"------------------------------"<<endl;
cout<<"Exercise 1"<<endl;
cout<<"Output should be:"<<endl;
cout<<"112, 119, 126, 133, 147, 154, 161, 168, 182, 189, 196,"<<endl;
cout<<"Your Answer: "<<endl;
exercise_1();
cout<<endl<<endl<<"press Enter to continue"<<endl;
cin.get();
cout<<"------------------------------"<<endl;
cout<<"Exercise 2"<<endl;
int n=2;
int p=3;
cout<<"input= 2, 3"<<endl;
cout<<"Output should be: 8"<<endl;
cout<<"Your Answer : ";
exercise_2(n, p);
n=4;
p=2;
cout<<endl;
cout<<"input= 4, 2"<<endl;
cout<<"Output should be: 16"<<endl;
cout<<"Your Answer : ";
exercise_2(n, p);
cout<<endl<<endl<<"press Enter to continue"<<endl;
cin.get();
cout<<"------------------------------"<<endl;
cout<<"Exercise 3"<<endl;
int s1=4;
int s2=6;
int s3=4;
cout<<"input= 4, 6, 4"<<endl;
cout<<"Output should be: isosceles"<<endl;
cout<<"Your Answer : ";
exercise_3(s1, s2, s3);
s1=3;
s2=3;
s3=3;
cout<<endl;
cout<<"input= 3, 3, 3"<<endl;
cout<<"Output should be: equilateral"<<endl;
cout<<"Your Answer : ";
exercise_3(s1, s2, s3);
s1=1;
s2=2;
s3=3;
cout<<endl;
cout<<"input= 1, 2, 3"<<endl;
cout<<"Output should be: scalene"<<endl;
cout<<"Your Answer : ";
exercise_3(s1, s2, s3);
s1=3;
s2=4;
s3=4;
cout<<endl;
cout<<"input= 3, 4, 4"<<endl;
cout<<"Output should be: isosceles"<<endl;
cout<<"Your Answer : ";
exercise_3(s1, s2, s3);
cout<<endl<<endl<<"press Enter to continue"<<endl;
cin.get();
cout<<"------------------------------"<<endl;
cout<<"Exercise 4"<<endl;
cout<<"try inputs: 3, 6, 2, 8, 0"<<endl;
cout<<"Your Answer: "<<endl;
exercise_4();
cout<<endl<<endl<<"press Enter to continue"<<endl;
cin.get();
cin.get();
cout<<"------------------------------"<<endl;
cout<<"Exercise 5"<<endl;
int arr[] = {3,6,8,2,7,8,1,0,0,0,0,0};
cout<<"Initial Array : ";
view_arr(arr);
cout<<endl;
int f = 7;
int x;
cout<<"input= 7"<<endl;
cout<<"Output should be: 4"<<endl;
x = exercise_5(arr, f);
cout<<"Your Answer : "<<x<<endl;
f = 8;
cout<<"input= 8"<<endl;
cout<<"Output should be: 2"<<endl;
x = exercise_5(arr, f);
cout<<"Your Answer : "<<x<<endl;
f = 9;
cout<<"input= 9"<<endl;
cout<<"Output should be: -1"<<endl;
x = exercise_5(arr, f);
cout<<"Your Answer : "<<x<<endl;
cout<<endl<<endl<<"press Enter to continue"<<endl;
cin.get();
cout<<"------------------------------"<<endl;
cout<<"Exercise 6"<<endl;
int arr2[] = {3,6,8,2,7,8,1,0,0,0,0,0};
cout<<"Initial Array : ";
view_arr(arr);
cout<<endl;
x = 8;
cout<<"input= 8"<<endl;
cout<<"Output should be: 3, 6, 8, -1, 2, 7, 8, 1"<<endl;
cout<<"Your Answer : ";
exercise_6(arr2, x);
view_arr(arr2);
cout<<endl<<endl<<"press Enter to continue"<<endl;
cin.get();
cout<<endl<<endl<<"End of Task I"<<endl;
cout<<"Congratulation on completing"<<endl;
return 0;
}