fatal error C1004: unexpected end of file found

tears_melt_sand 2016-12-28 11:07:15
#include <iostream>
#include <string>
using namespace std;
struct memo
{
int year1;
int month1;
int day1;
string content;
memo*next;
};

class mem
{
public:
void del();
void insert();
void sel();
void print();
private:
memo del_date;
memo sel_date;
memo choice;
memo*head,*m;
};

void class mem::del()
{
cout<<"请输入要删除的年月日及内容"<<endl;
cin>>del_date.year1>>del_date.month1>>del_date.day1>>del_date.content;
while (del_date.year1!=0||del_date.month1!=0||del_date.day1!=0||del_date.content!=0) //输入零停止
{
memo*a1,*a2;
if(head==NULL) //链表为空的情况
{
cout<<"内容为空!"<<endl;

}
a1=head;
while (del_date.year1!=a1->year1&&a1->next!=NULL) //寻找删除的结点
{
a2=a1;
a1=a1->next;
}
if(del_date.year1==a1->year1) //找到删除的同年结点
{
if(del_date.month1==a1->month1) //找到删除的同月结点
{
if(del_date.year1==a1->year1) //找到删除的同日结点
{
if(a1==head) head=a1->next;
else a2->next=a1->next;
}
else cout<<"不能找到该备忘记录"<<num; //没找到相应结点
}
else cout<<"不能找到该备忘记录"<<num; //没找到相应结点
}
else cout<<"不能找到该备忘记录"<<num; //没找到相应结点
cout<<"请输入要删除的年月日及内容:"<<endl;
cin>>del_date.year1>>del_date.month1>>del_date.day1>>del_date.content;
}
}

void class mem::insert()
{
memo*add,*a1,*a2;
a1=head;
cout<<"请输入要添加的年月日及内容:"<<endl;
add=new memo; //创建新的记录
cin>>add->year1>>add->month1>>add->day1>>add->content;
while (add->year1!=0||add->month1!=0||add->day1!=0||add->content!=0)
{
if(head==NULL) //原来链表为空,就放在第一个
{
head=add;
add->next=NULL;
}
else
{
while((add->year1>a1->year1)&&(a1->next!=NULL)) //寻找相应位置
{
a2=a1;
a1=a1->next;
}
if(add->year1<=a1->year1)
{
while((add->month1>a1->month1)&&(a1->next!=NULL)) //寻找相应位置
{
a2=a1;
a1=a1->next;
}
if(add->month1<=a1->month1)
{
while((add->day1>a1->day1)&&(a1->next!=NULL)) //寻找相应位置
{
a2=a1;
a1=a1->next;
}
if(add->day1<=a1->day1)
{
if(a1==head) head=add; //插在第一的位置
else a2->next=add; //插在非第一的位置
add->next=a1;
}
else //插在最后的位置
{
a1->next=add;
add->next=NULL;
}
}
else //插在最后的位置
{
a1->next=add;
add->next=NULL;
}
}
else //插在最后的位置
{
a1->next=add;
add->next=NULL;
}
}
cout<<"请输入要添加的年月日及内容:"<<endl;
add=new memo; //创建新的记录
cin>>add->year1>>add->month1>>add->day1>>add->content;
}
}

void class mem::print()
{
memo*p;
p=head;
if(head!=NULL)
do
{
cout<<p->year1<<" "<<p->month1<<" "<<p->day1<<" "<<p->content<<endl;
p=p->next;
}while(p!=NULL);
}

void class mem::sel()
{
cout<<"请输入要查看的年月日及内容:"<<endl;
cin>>sel_date.year1>>sel_date.month1>>sel_date.day1;
while (sel_date.year1!=0||sel_date.month1!=0||sel_date.day1!=0) //输入零停止
{
memo*a1,*a2;
if(head==NULL) //链表为空的情况
{
cout<<"内容为空!"<<endl;

}
a1=head;
while (sel_date.year1!=a1->year1&&a1->next!=NULL) //寻找查看的结点
{
a2=a1;
a1=a1->next;
}
if(sel_date.year1==a1->year1) //找到查看的结点
{
while (sel_date.month1!=a1->month1&&a1->next!=NULL) //寻找查看的结点
{
a2=a1;
a1=a1->next;
}
if(sel_date.month1==a1->month1) //找到查看的结点
{
while (sel_date.day1!=a1->day1&&a1->next!=NULL) //寻找查看的结点
{
a2=a1;
a1=a1->next;
}
for(;sel_date.day1==a1->day1;) //找到查看的结点
{
cout<<sel_date.year1<<sel_date.month1<<sel_date.day1<<sel_date.content;
a2=a1;
a1=a1->next;
}
}
}
else cout<<"没有找到相应日期的备忘录"<<num; //没找到相应结点
cout<<"请输入要查看的年月日及内容:"<<endl;
cin>>sel_date.year1>>sel_date.month1>>sel_date.day1;
}
}

int main()
{
mem a;
int choice;
cout<<"1:删除备忘记录"<<" "<<"2:添加备忘记录"<<" "<<"3:查看所有备忘记录"<<" "<<"4:查看一天的备忘记录"<<"5:退出"<<endl;
cin>>choice;
while(choice!=5)
{
if(choice==1)
{
a.del();
}
else if(choice==2)
{
a.insert();
}
else if(choice==3)
{
a.print();
}
else
{
a.sel();
}
cout<<endl;
cout<<"1:删除备忘记录"<<" "<<"2:添加备忘记录"<<" "<<"3:查看所有备忘记录"<<" "<<"4:查看一天的备忘记录"<<"5:退出"<<endl;
cin>>choice;
}
return 0;
}
没有少括号啊,是什么原因呢,求助大神!
...全文
190 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
小灸舞 2016-12-29
  • 打赏
  • 举报
回复
void class mem::del()改成void mem::del()才对,去掉class
void class mem::insert(),void class mem::print(),void class mem::sel()同理都去掉class
tears_melt_sand 2016-12-29
  • 打赏
  • 举报
回复
谢谢各位,特别谢谢qq423399099 ,是void class mem::del()这个写错了。 可是程序还是不行,还有什么别的问题么?[img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/monkey/31.gif][/可以帮我看看么?
ipqtjmqj 2016-12-29
  • 打赏
  • 举报
回复
你不会缩进吗,还有编译器报错在哪一行能说一下吗
sevancheng 2016-12-29
  • 打赏
  • 举报
回复
#include "stdafx.h"
笔记本的风扇控制 ---------------------------------------- 09 November 2006. Summary of changes for version 20061109: 1) ACPI CA Core Subsystem: Optimized the Load ASL operator in the case where the source operand is an operation region. Simply map the operation region memory, instead of performing a bytewise read. (Region must be of type SystemMemory, see below.) Fixed the Load ASL operator for the case where the source operand is a region field. A buffer object is also allowed as the source operand. BZ 480 Fixed a problem where the Load ASL operator allowed the source operand to be an operation region of any type. It is now restricted to regions of type SystemMemory, as per the ACPI specification. BZ 481 Additional cleanup and optimizations for the new Table Manager code. AcpiEnable will now fail if all of the required ACPI tables are not loaded (FADT, FACS, DSDT). BZ 477 Added #pragma pack(8/4) to acobject.h to ensure that the structures in this header are always compiled as aligned. The ACPI_OPERAND_OBJECT has been manually optimized to be aligned and will not work if it is byte-packed. Example Code and Data Size: These are the sizes for the OS- independent acpica.lib produced by the Microsoft Visual C++ 6.0 32- bit compiler. The debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: Non-Debug Version: 78.1K Code, 17.1K Data, 95.2K Total Debug Version: 155.4K Code, 63.1K Data, 218.5K Total Current Release: Non-Debug Version: 77.9K Code, 17.0K Data, 94.9K Total Debug Version: 155.2K Code, 63.1K Data, 218.3K Total 2) iASL Compiler/Disassembler and Tools: Fixed a problem where the presence of the _OSI predefined control method within complex expressions could cause an internal compiler error. AcpiExec: Implemented full region support for multiple address spaces. SpaceId is now part of the REGION object. BZ 429 ---------------------------------------- 11 Oc

33,311

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 新手乐园
社区管理员
  • 新手乐园社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧