#include<iostream>
#include<string>
#include<cstring>
using namespace std;
class PA{
public:
PA (const char*);
void AddTodo();
void ListTodos() const;
void MarkAsDone();
private:
string * str;
int count;
};
PA::PA(const char *name)
{
cout<<"WELCOME TO YOUR PERSONAL ASSISTANT,"<<name<<"!"<<endl;
count=0;
}
void PA::AddTodo()
{
string s;
getline(cin,s,'#');
str[count]=s;
count++;
}
void PA::ListTodos() const
{
cout<<"Here is your work list:"<<endl;
for(int i=0;i<count;i++)
{
cout<<str[i]<<endl;
}
}
void PA::MarkAsDone()
{
cout<<"Please enter your finished task :"<<endl;
string task;
getline(cin,task);
int index=0;
for(int i=0;i<count;i++){
if(str[i]==task)
{
index=i;
}
}
for(int j=index;j<count;j++)
{
str[index]=str[index+1];
}
}
int main(){
PA mypa("name");
cout<<"If you want to add a new task,please enter A;"<<endl;
cout<<"If you want to check your list,please enter L;"<<endl;
cout<<"If you want to mark the tasks that you have done,please enter M. "<<endl;
cout<<"If you want to end this program,please enter E"<<endl;
char ch='0';
while(ch!='E')
{
cin>>ch;
if(ch=='A')
{
mypa.AddTodo();
}
else if (ch=='L')
{
mypa.ListTodos();
}
else if (ch=='M')
{
mypa.MarkAsDone();
}
else if(ch=='E')
break;
}
return 0;
}
#include<string>
#include<cstring>
using namespace std;
class PA{
public:
PA (const char*);
void AddTodo();
void ListTodos() const;
void MarkAsDone();
private:
string * str;
int count;
};
PA::PA(const char *name)
{
cout<<"WELCOME TO YOUR PERSONAL ASSISTANT,"<<name<<"!"<<endl;
count=0;
}
void PA::AddTodo()
{
string s;
getline(cin,s,'#');
str[count]=s;
count++;
}
void PA::ListTodos() const
{
cout<<"Here is your work list:"<<endl;
for(int i=0;i<count;i++)
{
cout<<str[i]<<endl;
}
}
void PA::MarkAsDone()
{
cout<<"Please enter your finished task :"<<endl;
string task;
getline(cin,task);
int index=0;
for(int i=0;i<count;i++){
if(str[i]==task)
{
index=i;
}
}
for(int j=index;j<count;j++)
{
str[index]=str[index+1];
}
}
int main(){
PA mypa("name");
cout<<"If you want to add a new task,please enter A;"<<endl;
cout<<"If you want to check your list,please enter L;"<<endl;
cout<<"If you want to mark the tasks that you have done,please enter M. "<<endl;
cout<<"If you want to end this program,please enter E"<<endl;
char ch='0';
while(ch!='E')
{
cin>>ch;
if(ch=='A')
{
mypa.AddTodo();
}
else if (ch=='L')
{
mypa.ListTodos();
}
else if (ch=='M')
{
mypa.MarkAsDone();
}
else if(ch=='E')
break;
}
return 0;
}