-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTo do
More file actions
42 lines (35 loc) · 971 Bytes
/
Copy pathTo do
File metadata and controls
42 lines (35 loc) · 971 Bytes
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
#include <iostream>
using namespace std;
int main() {
string tasks[100]; // fixed size
int count = 0; // how many tasks added
int choice;
do {
cout << "\n1. Add Task\n";
cout << "2. View Tasks\n";
cout << "3. Exit\n";
cout << "Enter choice: ";
cin >> choice;
cin.ignore();
if (choice == 1) {
if (count < 100) {
cout << "Enter task: ";
getline(cin, tasks[count]);
count++;
cout << "Task added\n";
} else {
cout << "Task list full\n";
}
}
else if (choice == 2) {
if (count == 0) {
cout << "No tasks yet\n";
} else {
for (int i = 0; i < count; i++) {
cout << i + 1 << ". " << tasks[i] << endl;
}
}
}
} while (choice != 3);
return 0;
}