标题:我一程序出现错误 麻烦高手给看下
取消只看楼主
情非得已
Rank: 1
等 级:新手上路
帖 子:59
专家分:5
注 册:2011-4-23
结帖率:100%
已结贴  问题点数:5 回复次数:3 
我一程序出现错误 麻烦高手给看下
fatal error C1083: Cannot open include file: 'function.h': No such file or directory
搜索更多相关主题的帖子: include file 
2011-05-24 11:08
情非得已
Rank: 1
等 级:新手上路
帖 子:59
专家分:5
注 册:2011-4-23
得分:0 
百度上说   看看有没有#include "function.h"  这个错误提示你包含了一个不存在的文件
 我不是太理解啥意思
2011-05-24 11:09
情非得已
Rank: 1
等 级:新手上路
帖 子:59
专家分:5
注 册:2011-4-23
得分:0 
function.h  不是系统自带的吗
2011-05-24 20:47
情非得已
Rank: 1
等 级:新手上路
帖 子:59
专家分:5
注 册:2011-4-23
得分:0 
我把程序发上来大家帮忙看下吧  
#include<iostream.h>
#include<windows.h>
#include"function.h"
int main()
{
    int n;
    do
    {
    desktop();
    cin>>n;
    system("cls");
    if(n==1)
        {
            input();
            
        }
        else if(n==2)
        {
            sort();
        }
        else if(n==3)
        {   
            search();
        }
        else if(n==4)
        {   
            reput();
        }
        }
    while(n!=0);
    return 0;
 }

Function.h

#include<iostream.h>
#include<windows.h>
struct product
{
    int code;
    char name[10];
    float amount;
    float sales;
    float stock;
}pro[5];
//……产品输入……
void input()
{
    for(int i=0;i<5;i++)
    {
        cout<<"请输入第"<<i+1<<"种产品代码:";
       cin>>pro[i].code;
        cout<<"请输入第"<<i+1<<"种产品名称:";
        cin>>pro[i].name;
        cout<<"请输入第"<<i+1<<"种产品数量:";
        cin>>pro[i].amount;
        cout<<"请输入第"<<i+1<<"种产品销售量:";
        cin>>pro[i].sales;
        pro[i].stock=pro[i].amount-pro[i].sales;
         system("cls");
    }
}

//……产品库存量升序排列
void sort()
{
    product temp;
    for(int i=0;i<5-1;i++)
        for(int j=i+1;j<=5-1;j++)
            if(pro[i].stock>pro[j].stock)
            {
                temp=pro[i];
                pro[i]=pro[j];
                pro[j]=temp;
            }
            for(int j=0;j<=5-1;j++)
            {
                cout<<"库存量排第"<<j+1<<"种产品的库存是"<<pro[j].stock<<endl;
                cout<<"代码是"<<pro[j].code<<endl;
                cout<<"名称是"<<pro[j].name<<endl;
                cout<<"数量是"<<pro[j].amount<<endl;
                cout<<"销售量是"<<pro[j].sales<<endl<<endl;
            }
            system("pause");
            system("cls");
}
//……产品代码查找……
void search()
{
        int code[5]={1,2,3,4,5};
        bool flag=0;
        int b;
        cout<<"请输入要查询的代码为:";
        cin>>b;
        for(int i=0;i<5;++i)
            if(b==pro[i].code)
            {
                flag=1;
                cout<<"产品代码:"<<pro[i].code<<" "
                    <<"名称:"<<pro[i].name<<" "
                    <<"数量:"<<pro[i].amount<<" "
                    <<"销售量:"<<pro[i].sales<<endl;
            }
        if(flag==0)
            cout<<"此代码不存在!"<<endl;
        system("pause");
        system("cls");
 }  
//……修改已输入产品信息
void reput()
{
    int code;
    cout<<"已输入产品代码分别是:"<<endl;
    for(int k=0;k<=5-1;k++)
        cout<<pro[k].code<<endl;
    cout<<"您要修改的产品代码是多少?"<<endl;
    cin>>code;
    for(int i=0;i<=4;i++)
    {
        if (pro[i].code==code)    break;
    }
    if(i==5)
        cout<<"没有您要修改的产品"<<endl;
    else
    {
        cout<<"请输入您要修改的产品的代码"<<endl;
        cin>>pro[i].code;
        cout<<"请输入您要修改的产品的名字"<<endl;
        cin>>pro[i].name;
        cout<<"请输入您要修改的产品的数量"<<endl;
        cin>>pro[i].amount;
        cout<<"请输入您要修改的产品的销售量"<<endl;
        cin>>pro[i].sales;
        pro[i].stock=pro[i].amount-pro[i].sales;
    }
    system("pause");
       system("cls");
}
//++++++++++++++desktop+++++++++++++++
void desktop()
{
    cout<<endl;
    cout<<"********************欢迎进入产品管理系统********************"<<endl
        <<" ***                 请选择您要的服务                     ***"<<endl
        <<" ***                 1.输入产品信息                       ***"<<endl
        <<" ***                 2.查看产品信息                       ***"<<endl
        <<" ***                 3.查找产品信息                       ***"<<endl
        <<" ***                 4.修改产品信息                       ***"<<endl
        <<"***                 0.退出系统                           ***"<<endl
        <<"***********************************************************"<<endl;
    cout<<endl;
    cout<<"请输入相应的代码:";
}
2011-05-25 21:48



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-340817-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.757286 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved