VC++6.0系统中总出现unexpected tokenendend of file found是什么情况??求大神解答,我的程序错在了哪里。

10:46 提问
C++出现 unexpected end of file found
下面是代码:
#define StrNum 20
#define Type 20
#include &iostream&
#include &iomanip&
#include &string&
#include &fstream&
//输入输出文件流
const int Maxb=100;
//最多可存储的图书
class Book
//删除标记
//图书编号
//增加标记
char number[StrNum];
char bookname[StrNum];
char bookkind[Type];
//图书类型
char getkind()
//获取图书类型
return bookkind[Type];
char getname()
//获取书名
bookname[StrNum];
int getnum()
//获取图书编号
int getlab()
//获取删除标记
void setname(char na[])
//设置书名
strcpy(bookname,na);
void setkind(char kin[])
//设置类型
strcpy(bookkind,kin);
void delbook()
//删除图书
void addbook(int n,char *na,char *kin)
//增加图书
strcpy(bookname,na);
strcpy(bookkind,kin);
void disp()
//输出图书
cout.flags (ios::left);
//设置对齐的标志位为左
cout&&setw(15)&&num&&setw(20)&&bookname&&setw(15)&&bookkind&&
class BDatabase
Book book[Maxb];
//图书记录
BDatabase()
//构造函数,将book.txt读到book[]中
fstream file("book.txt",ios::in);
file.read((char *)&b,sizeof(b));
if (!file)
book[top]=b;
file.close();
void clear()
int addbook(int n,char *na,char *kin)
//增加图书
Book *p=query(n);
if(NULL==p)
book[top].addbook(n,na,kin);
Book *query(int bookid)
//查找图书
for(int i=0;i&=i++)
if(book[i].getnum()==bookid&&book[i].getlab()==0)
return &book[i];
return NULL;
void disp()
for(int i=0;i&=i++)
if (book[i].getlab()==0)
book[i].disp();
~BDatabase()
//析构函数,将book[]写到book.txt中,实现文本的写入
fastream file("book.txt",ios::out);
for(int i=0;i&=i++)
if(book[i].getlab()==0)
file.write((char*)&book[i],sizeof(book[i]));
file.close();
void main()
BDatabase BookDB;
char bname[40];
char bkind[40];
char newType[20];
while (choice!='0')
cout&&"\t******************************************************************\n";
cout&&"\t\t\t图
cout&&"\t\t\t1
新增图书记录\n";
cout&&"\t\t\t2
更改图书记录\n";
cout&&"\t\t\t3
删除图书记录\n";
cout&&"\t\t\t4
查找图书记录\n";
cout&&"\t\t\t5
显示图书记录\n";
cout&&"\t\t\t6
清空全部记录(慎用)\n";
cout&&"\t\t\t0
退出系统\n";
cout&&"\t******************************************************************\n";
cout&&"请选择(1,2,3,4,5,6,0):";
switch (choice)
cout&&"输入图书编号:"&&
cout&&"输入图书类型:"&&
cout&&"输入图书书名:"&&
BookDB.addbook(bookid,bname,newType);
cout&&"输入图书编号:"&&
b=BookDB.query(bookid);
if(b==NULL)
cout&&"该图书不存在"&&
cout&&"输入新的书名:"&&
b-&setname(bname);
cout&&"输入新的类型:"&&
b-&setkind(bkind);
cout&&"读入图书编号:"&&
b=BookDB.query(bookid);
if(b==NULL)
cout&&"该图书不存在"&&
cout&&"确定要删除此记录吗?(Y/N)"&&
if(tg1!='n'&&tg1!='N')
b-&delbook();
cout&&"已成功删除该书记录!"&&
cout&&"读入图书编号:"&&
b=BookDB.query(bookid);
if(b==NULL)
cout&&"该图书不存在"&&
cout&&"图书编号
b-&disp();
cout&&"图书编号
b-&disp();
cout&&"确定要清空所有记录吗?(Y/N)"&&
if(tg2!='n'&&tg2!='N')
BookDB.clear();
cout&&"已成功清空记录!"&&
default:cout&&"输入错误,请从新输入(数字为0~6):";
按赞数排序
BDatabase类定义没有分号
你的main函数怎么 放在BDatabase类里面,main函数需要单独出来
字面意思就是异常的文件结尾,你这个代码有两个问题,一个是main函数怎么能放在类声明里面的呢?
再就是类声明需要结束要有一个分号,就像你的book类一样。
BDatabase类定义没有分号。请采纳wcg1988923的建议
void main() 前面增加一行加个 };
汗. 你 } 格式都没对齐
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐您还可以使用以下方式登录
当前位置:&>&&>&&>& > VC++编译错误信息
VC++编译错误信息
VC++编译错误信息总结&&&&&& 0、 error C2180: controlling expression has type 'void'&&&&&&& 定义方式不应该为void类型;&&&&& 1、fatal error C1010: unexpected end of file while looking for precompiled header directive。  寻找预编译头文件路径时遇到了不该遇到的文件尾。(一般是没有#include &stdafx.h&)  2、fatal error C1083: Cannot open include file: 'R&&.h': No such file or directory  不能打开包含文件&R&&.h&:没有这样的文件或目录。  3、error C2011: 'C&&': 'class' type redefinition  类&C&&&重定义。  4、error C2018: unknown character '0xa3'  不认识的字符'0xa3'。(一般是汉字或中文标点符号)  5、error C2057: expected constant expression  希望是常量表达式。(一般出现在switch语句的case分支中)  6、error C2065: 'IDD_MYDIALOG' : undeclared identifier  &IDD_MYDIALOG&:未声明过的标识符。  7、error C2082: redefinition of formal parameter 'bReset'  函数参数&bReset&在函数体中重定义。  8、error C2143: syntax error: missing ':' before '{'  句法错误:&{&前缺少&;&。  9、error C2146: syntax error : missing ';' before identifier 'dc'  句法错误:在&dc&前丢了&;&。  10、error C2196: case value '69' already used  值69已经用过。(一般出现在switch语句的case分支中)&&&&&& 11、error C2509: 'OnTimer' : member function not declared in 'CHelloView'  成员函数&OnTimer&没有在&CHelloView&中声明。  12、error C2511: 'reset': overloaded member function 'void (int)' not found in 'B'  重载的函数&void reset(int)&在类&B&中找不到。  13、error C2555: 'B::f1': overriding virtual function differs from 'A::f1' only by return type or calling convention  类B对类A中同名函数f1的重载仅根据返回值或调用约定上的区别。  14、error C2660: 'SetTimer' : function does not take 2 parameters  &SetTimer&函数不传递2个参数。  15、warning C4035: 'f&&': no return value  &f&&&的return语句没有返回值。  16、warning C4553: '= =' : op did you intend '='?  没有效果的运算符&= =&;是否改为&=&?  17、warning C4700: local variable 'bReset' used without having been initialized  局部变量&bReset&没有初始化就使用。  18、error C4716: 'CMyApp::InitInstance' : must return a value  &CMyApp::InitInstance&函数必须返回一个值。  19、LINK : fatal error LNK1168: cannot open Debug/P1.exe for writing  连接错误:不能打开P1.exe文件,以改写内容。(一般是P1.Exe还在运行,未关闭)  20、error LNK2001: unresolved external symbol &public: virtual _ _thiscall C&&::~C&&(void)&  连接时发现没有实现的外部符号(变量、函数等)。  function call missing argument list 调用函数的时候没有给参数。  member function definition looks like a ctor, but name does not match enclosing class 成员函数声明了但没有使用unexpected end of file while looking for precompiled header directive在寻找预编译头文件时文件意外结束,编译不正常终止可能造成这种情况 !&就爱阅读www.92to.com网友整理上传,为您提供最全的知识大全,期待您的分享,转载请注明出处。
欢迎转载:
推荐:    安装VC++6.0时出现这个情况什么意思,怎么解决??_百度知道
安装VC++6.0时出现这个情况什么意思,怎么解决??
您的回答被采纳后将获得:
系统奖励15(财富值+成长值)+难题奖励10(财富值+成长值)+提问者悬赏10(财富值+成长值)
我有更好的答案
安装包有问题或者重启电脑试试
忽略,意思是无关删除字体文件。
选择忽略就可以的
为您推荐:
其他类似问题
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。fatal error C1004: unexpected end of file found
20hu_huiqin]
编辑:www.fx114.net
本篇文章主要介绍了"fatal error C1004: unexpected end of file found
20hu_huiqin]",主要涉及到fatal error C1004: unexpected end of file found
20hu_huiqin]方面的内容,对于fatal error C1004: unexpected end of file found
20hu_huiqin]感兴趣的同学可以参考一下。
我用VC写的队列思想的迷宫算法,但出现了两个错误:
(1)fatal&error&C1004:&unexpected&end&of&file&found
(2)error&C2143:&syntax&error&:&missing&';'&before&'&position&
不知怎样改,希望有高手帮忙,谢谢。
以下是代码:
一、队列部分
//&LinkedQueue.h:&interface&for&the&LinkedQueue&class.
//////////////////////////////////////////////////////////////////////
#if&!defined(AFX_LINKEDQUEUE_H__9DF1C2BF_29BB_490E_8DF7_96D30C7CC481__INCLUDED_)
#define&AFX_LINKEDQUEUE_H__9DF1C2BF_29BB_490E_8DF7_96D30C7CC481__INCLUDED_
#include&"Node.h"
#if&_MSC_VER&&&1000
#pragma&once
#endif&//&_MSC_VER&&&1000
template&class&T&
class&LinkedQueue&&
LinkedQueue(){front=rear=0;}
virtual&~LinkedQueue(){
while(front){
next=front-&
bool&IsEmpty()const
return&((front)?false:true);}
bool&IsFull()const
Node&T&&*p;
try{p=new&Node&T&;
catch(...){return&}
T&First()const{
if(IsEmpty())throw&OutOfBounds();
return&front-&}
T&Last()const{
if(IsEmpty())throw&OutOfBounds();
return&rear-&}
LinkedQueue&T&&Add(const&T&x){
Node&T&&*p=new&Node&T&;
p-&data=x;
p-&link=0;
if(front)rear-&link=p;
else&front=p;
LinkedQueue&T&&Delete(&T&x){
if(IsEmpty())throw&OutOfBounds();
Node&T&&*p=
front=front-&
#endif&//&!defined(AFX_LINKEDQUEUE_H__9DF1C2BF_29BB_490E_8DF7_96D30C7CC481__INCLUDED_)
二、队列中使用的Node
//&Node.h:&interface&for&the&Node&class.
//////////////////////////////////////////////////////////////////////
#if&!defined(AFX_NODE_H___7C_29BDDE3EDB55__INCLUDED_)
#define&AFX_NODE_H___7C_29BDDE3EDB55__INCLUDED_
#if&_MSC_VER&&&1000
#pragma&once
#endif&//&_MSC_VER&&&1000
template&class&T&
class&Node&&
#endif&//&!defined(AFX_NODE_H___7C_29BDDE3EDB55__INCLUDED_)
三、包含main函数的:
//&maze.cpp&:&Defines&the&entry&point&for&the&console&application.
//用队列思想查找迷宫中最短路径。
#include&"stdafx.h"
#include&&iostream.h&
#include&"LinkedQueue.h"
#include&"Node.h"
#include&string.h&
#include&stdio.h&
#include&&stdlib.h&
struct&Position{
int&m,n,p,q,r,s;
Position&*
int&&pathL
bool&FindPath(Position&start,Position&finish,int&&PathLen,Position&*&&path){
if((start.row==finish.row)&&(start.col==finish.col)){
PathLen=0;return&}
Position&offset[4];
offset[0].row=0;offset[0].col=1;
offset[1].row=1;offset[1].col=0;
offset[2].row=0;offset[2].col=-1;
offset[3].row=-1;offset[3].col=0;
int&NumOfNbrs=4;
Position&here,
here.row=start.
here.col=start.
grid[start.row][start.col]=2;
LinkedQueue&Position&&Q;
for(int&b=0;b&NumOfNb++){
nbr.row=here.row+offset[b].
nbr.col=here.col+offset[b].
if(grid[nbr.row][nbr.col]==0){
grid[nbr.row][nbr.col]=grid[here.row][here.col]+1;
if((nbr.row==finish.row)&&(nbr.col==finish.col))&
Q.Add(nbr);}
if((nbr.row==finish.row)&&(nbr.col==finish.col))&
if(Q.IsEmpty())&return&
Q.Delete(here);
}while(true);
PathLen=grid[finish.row][finish.col]-2;
path=new&Position[PathLen];
for(int&c=PathLen-1;c&=0;c--){
for(int&d=0;d&NumOfNd++){
nbr.row=here.row+offset[d].
nbr.col=here.col+offset[d].
if(grid[nbr.row][nbr.col]==c+2)&
int&main(int&argc,&char*&argv[])
cout&&"欢迎进入!"&&
cout&&"please&input&the&row-m,and&the&column-n:"&&
cin&&m&&n;
maze=new&int*[m+2];
cout&&"初始化迷宫为:"&&
for(int&i=1;i&=m;i++){
maze[i]=new&int[n+2];
for(int&j=1;j&=n;j++){
maze[i][j]=0;
cout&&"&"&&maze[i][i];}
cout&&"随机产生的迷宫为:"&&
for(int&i=1;i&=m;i++){
for(int&j=1;j&=n;j++){
maze[i][j]=rand()%2;}
for(int&i=1;i&=m;i++){
for(int&j=1;j&=n;j++){
cout&&maze[i][j]&&"&";}
cout&&"请输入初始位置所在的行和列:"&&
cin&&p&&q;
cout&&"请输入初始位置所在的行和列:"&&
cin&&r&&s;
Position&start.row=p;start.col=q;
Position&finish.row=r;finish.col=s;
if(FindPath(start,finish,pathLen,path))
for(int&d=0;d&=pathLd++)
cout&&"("&&path[d].row&&","&&path[d].col&&")"&&"&";
else&cout&&"没有通路。"&&
}忘了一点,第一部分和第二部分均是在头文件中你的类的结尾有右花括号和分号吗?
};该回复于 09:38:53被版主删除同意3楼
Node.h里面class&Node的定义最后没写;第二部分均是在头文件中,放CPP文件试试
一、不得利用本站危害国家安全、泄露国家秘密,不得侵犯国家社会集体的和公民的合法权益,不得利用本站制作、复制和传播不法有害信息!
二、互相尊重,对自己的言论和行为负责。
本文标题:
本页链接:用VC++6.0编译时总是出现File not found肿么办。。。。工程和文件都选了啊啊啊_百度知道
用VC++6.0编译时总是出现File not found肿么办。。。。工程和文件都选了啊啊啊
我有更好的答案
你经过编译,连接和执行了吗?工程目录下有这个文件吗?
已经创建了新的工程和文件了。。。。然而最后还是显示
文件不存在,也就不能编译了
你把整个界面截图下来
用我的绿色版vc++6.0吧
嗯,好的,谢谢哈^ω^
已经OK啦😄
采纳率:61%
来自团队:
试试英文工程名和路径
你用的win10, 用vc6有很多问题的,上网找相关的补丁文件
嗯,谢谢大神咯,那有啥别的不用补丁的编程软件不 ∏_∏
vs2008, vs2010,vs2013
嗯,好的,我试试哈,真的谢谢啦(。・ω・。)
为您推荐:
其他类似问题
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。

我要回帖

更多关于 by the end of 的文章

 

随机推荐