找回密码
 注册
搜索
热搜: 回贴
  • 前程无忧官网首页 有什么好的平台可以
  • 最新的销售平台 互联网营销的平台有哪
  • 制作网页的基本流程 网页制作和网页设
  • 【帝国CMS】输出带序号的列表(数字排
  • 网站建设公司 三一,中联,极东泵车的
  • 织梦 建站 织梦网站模版后台怎么更改
  • 云服务官网 哪些网站有免费的简历模板
  • 如何建网站要什么条件 建网站要用什么
  • 吉林市移动公司电话 吉林省退休人员网
  • 设计类毕业论文 网站设计与实现毕业论
查看: 876|回复: 0

[讨论]关于头文件的设置

[复制链接]
发表于 2009-11-2 02:53:32 | 显示全部楼层 |阅读模式 IP:江苏扬州
UITLITY.H的源文件如下:
#include <iostream.h>
#include <fstream.h>
#include <string.h>
#include <ctype.h>
#include <time.h>

enum Error_code { success, fail, range_error, underflow, overflow, fatal,
not_present, duplicate_error, entry_inserted, entry_found,
internal_error };
bool user_says_yes();
====================
UTILITY.CPP 的源文件
#include "UTILITY.H" //与头文件相连
bool user_says_yes()
{
int c;
bool initial_response = true;
do { // Loop until an appropriate input is received.
if (initial_response)
cout << " (y,n)? " << flush;
else
cout << "Respond with either y or n: " << flush;
do { // Ignore white space.
c = cin.get();
} while (c == '\n' || c ==' ' || c == '\t');
initial_response = false;
} while (c != 'y' && c != 'Y' && c != 'n' && c != 'N');
return (c == 'y' || c == 'Y');
}
===============================================
queue.h的源文件
const int maxqueue=20;
class Queue {
public:
Queue();
bool empty() const;
Error_code append(const Queue_entry &item);
Error_code retrieve(Queue_entry &item) const;
protected:
int count;
int front,rear;
Queue_entry entry[maxqueue];
};
==========================================
queue.cpp 的源文件
#include "queue.h" //与头文件相连
Queue::Queue()
/*Post:The Queue is initialized to be empty.*/
{
count=0;
rear=maxqueue-1;
front=0;
}
bool Queue::empty() const
/*Post:Return true if the Queue is empty,otherwise return false.*/
{
return count==0;
}
Error_code Queue::append(const Queue_entry &item)
/*Post: item is added to the rear if the Queue.if the Queue is full return an
Error_code of overflow and leave the Queue unchanged.*/
{
if(count>=maxqueue) return overflow;
count++;
rear=((rear+1)==maxqueue) ? 0:(rear+1);
entry[rear]=item;
return success;
}
Error_code Queue::retrieve(Queue_entry &item) const
/*Post:The front of the Queue retrieved to the output parameter item. if the
Queue is empty return an Error_code of underflow.*/
{
if(count<=0) return underflow;
item=entry[front];
return success;
}
======================
如果将主函数设置如下时,出现错误链接的信息,头文件
"UITLITY.H"总是链接不上。请帮我找找原因!!
#include "UITLITY.H" //链接UITLITY.H
typedef double Queue_entry;
#include "queue.h"
void main()
{
...........
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-29 23:34 , Processed in 0.192107 second(s), 13 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表