Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import <Foundation/Foundation.h>
- #import <Foundation/NSArray.h>
- #import "Task.h"
- #import "TodoList.h"
- void showTasks(NSMutableArray* tasks);
- int main (int argc, const char * argv[])
- {
- NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
- TodoList* todoList = [[ TodoList alloc ] init];
- [ todoList addTask: @"task 1" iscompleted: false priority : 3];
- [ todoList addTask];
- [ todoList addTask: @"task 2" iscompleted: true priority : 2];
- [ todoList addTask: @"task 3" iscompleted: false priority : 5];
- [ todoList addTask: @"task 4" iscompleted: true priority : 1];
- [ todoList showTasks ];
- NSMutableArray *mListTasks;
- NSLog(@"Completed tasks: ");
- mListTasks = [todoList getCompletedTasks];
- showTasks(mListTasks);
- NSLog(@"Not Completed tasks: ");
- mListTasks = [todoList getNotCompletedTasks];
- showTasks(mListTasks);
- [pool drain];
- return 0;
- }
- void showTasks(NSMutableArray* tasks) {
- int i;
- for(i = 0; i < tasks.count; ++i) {
- Task *t = [tasks objectAtIndex: i];
- NSLog(t.task);
- NSLog(t.iscompleted ? @"Completed" : @"Not completed");
- NSLog(@"%d",t.priority);
- NSLog(@"---------------------------------*****-");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement