
哪里有用C或C++写的留言簿源代码?谢谢!有重金酬谢
1.信息发表模块用户可以在系统上发布新的留言信息,提供信息发布表单供用户发布新的留言(留言信息、留言时间、留言人等)2.信息显示模块用户发布的留言信息能够在系统上显示(留...
1.信息发表模块 用户可以在系统上发布新的留言信息,提供信息发布表单供用户发布新的留言(留言信息、留言时间、留言人等)
2.信息显示模块 用户发布的留言信息能够在系统上显示(留言信息、留言时间、留言姓名等),可以根据时间、姓名查询留言信息,根据时间排序显示数据信息,还需分页显示数据
3.留言回复 可以对用户发布的留言进行回复,以实现相互间的交互
4.系统管理 管理员能够对发布的信息进行管理(修改留言信息、删除留言信息、查询留言信息),对用户信息进行管理(增加、修改、删除、查询)
这是具体的功能实现要求,重点不是放在显示模块上。谢谢!可以帮忙尽快弄好吗?非常感谢 展开
2.信息显示模块 用户发布的留言信息能够在系统上显示(留言信息、留言时间、留言姓名等),可以根据时间、姓名查询留言信息,根据时间排序显示数据信息,还需分页显示数据
3.留言回复 可以对用户发布的留言进行回复,以实现相互间的交互
4.系统管理 管理员能够对发布的信息进行管理(修改留言信息、删除留言信息、查询留言信息),对用户信息进行管理(增加、修改、删除、查询)
这是具体的功能实现要求,重点不是放在显示模块上。谢谢!可以帮忙尽快弄好吗?非常感谢 展开
2个回答
展开全部
这个是我用c++写的
#include<iostream>
#include"fstream"
using namespace std;
class Message
{
public:
char msg[200];
friend ostream & operator<<(ostream &out,Message &s);
friend istream & operator>>(istream &in,Message &s);
};
ostream & operator<<(ostream &out,Message &s)
{
out<<s.msg<<'\n';
return out;
}
istream & operator>>(istream &in,Message &s)
{
in>>s.msg;
return in;
}
int main()
{
ofstream ofile;
ifstream ifile;
Message s;
ifile.open("message.txt");
if(ifile.fail())
{
ofile.open("message.txt");
cout<<"这是一个留言程序,请留言:"<<endl;
cin>>s;
ofile<<s;
ofile.close();ifile.close();
}
else
{
cout<<"留言内容是:"<<endl;
ifile>>s;
while(!ifile.eof())
{
cout<<s;
ifile>>s;
}
ifile.close();
for(;;)
{
int option;
cout<<"please choose:"<<endl
<<"1-------------------add message"<<endl
<<"2-------------------cover ever message"<<endl
<<"3-------------------print message"<<endl
<<"0-------------------exit"<<endl;
cin>>option;
switch(option)
{
case 1:
ofile.open("message.txt",ios::app);
cout<<"please input a message:"<<endl;
cin>>s;
ofile<<s;
ofile.close();
break;
case 2:
ofile.open("message.txt",ios::trunc);
cout<<"please input a message:"<<endl;
cin>>s;
ofile<<s;
ofile.close();
break;
case 3:
ifile.open("message.txt");
ifile>>s;
while(!ifile.eof())
{
cout<<s;
ifile>>s;
}
ifile.close();
break;
case 0:
ofile.close();
return 0;
}
}
}
return 0;
}
#include<iostream>
#include"fstream"
using namespace std;
class Message
{
public:
char msg[200];
friend ostream & operator<<(ostream &out,Message &s);
friend istream & operator>>(istream &in,Message &s);
};
ostream & operator<<(ostream &out,Message &s)
{
out<<s.msg<<'\n';
return out;
}
istream & operator>>(istream &in,Message &s)
{
in>>s.msg;
return in;
}
int main()
{
ofstream ofile;
ifstream ifile;
Message s;
ifile.open("message.txt");
if(ifile.fail())
{
ofile.open("message.txt");
cout<<"这是一个留言程序,请留言:"<<endl;
cin>>s;
ofile<<s;
ofile.close();ifile.close();
}
else
{
cout<<"留言内容是:"<<endl;
ifile>>s;
while(!ifile.eof())
{
cout<<s;
ifile>>s;
}
ifile.close();
for(;;)
{
int option;
cout<<"please choose:"<<endl
<<"1-------------------add message"<<endl
<<"2-------------------cover ever message"<<endl
<<"3-------------------print message"<<endl
<<"0-------------------exit"<<endl;
cin>>option;
switch(option)
{
case 1:
ofile.open("message.txt",ios::app);
cout<<"please input a message:"<<endl;
cin>>s;
ofile<<s;
ofile.close();
break;
case 2:
ofile.open("message.txt",ios::trunc);
cout<<"please input a message:"<<endl;
cin>>s;
ofile<<s;
ofile.close();
break;
case 3:
ifile.open("message.txt");
ifile>>s;
while(!ifile.eof())
{
cout<<s;
ifile>>s;
}
ifile.close();
break;
case 0:
ofile.close();
return 0;
}
}
}
return 0;
}
追问
你好,谢谢你的回答。但是你可以帮忙再改改不,就是套用上链表,其功能加上用户的发表留言,查看留言等。还有加上管理员的登录,再对留言进行回复,删除,修改等操作。谢谢!时间越快越好。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询