Advertisement
Guest User

Untitled

a guest
Dec 15th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.54 KB | None | 0 0
  1. ///////////class.h
  2. #pragma once
  3. #include <iostream>
  4. #include <fstream>
  5. using namespace std;
  6. class task_manager
  7. {
  8.     string describe;
  9.     string name;
  10.     string id;
  11.     string day;
  12.     string month;
  13.     string year;
  14.     string time;
  15.     bool finished;
  16.  
  17. public:
  18.    
  19.     void deleteTask(int i);
  20.     void AddTask(string name, string describe, string day, string month, string year, string time);
  21.     bool submit();
  22.     void search();
  23.     void read();
  24.     void update();
  25.     task_manager();
  26.     ~task_manager();
  27. };
  28.  
  29.  
  30. ////////class.cpp
  31.  
  32. #include "task_manager.h"
  33. #include <fstream>
  34. #include <queue>
  35. #include <string>
  36.  
  37. void task_manager::AddTask(string name, string describe, string day, string month, string year, string time) {
  38.  
  39.     queue<string> task;
  40.     string input; char choice = 'y'; int counter = 0;
  41.  
  42.     while (choice == 'y') {
  43.  
  44.         cout << "Enter task: ";
  45.         cin >> name;
  46.  
  47.         task.push(name);
  48.         counter++;
  49.  
  50.         cin >> describe;
  51.         task.push(describe);
  52.         counter++;
  53.  
  54.         cin >> day;
  55.         task.push(day);
  56.         counter++;
  57.  
  58.         cin >> month;
  59.         task.push(month);
  60.         counter++;
  61.  
  62.         cin >> year;
  63.         task.push(year);
  64.         counter++;
  65.  
  66.         cin >> time;
  67.         task.push(time);
  68.         counter++;
  69.  
  70.         task.push("0@");
  71.         counter++;
  72.  
  73.         cout << "more? " << endl;
  74.         cin >> choice;
  75.  
  76.     }
  77.  
  78.     ofstream write;
  79.     write.open("C:/New Folder/information.txt", write.app);
  80.     for (int i = 0; i < counter; i++) {
  81.        
  82.         if (task.front() == "0@") {        //end of each task
  83.             write << task.front() << endl;
  84.             task.pop();
  85.         }
  86.  
  87.         write << task.front() <<" "; //'*';
  88.         task.pop();
  89.  
  90.    
  91.     }
  92.     write.close();
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement