| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 518 人关注过本帖
标题:编译无错,链接出错,求指教
只看楼主 加入收藏
帅mmmmmm哥
Rank: 1
等 级:新手上路
帖 子:6
专家分:6
注 册:2013-11-3
结帖率:50%
收藏
已结贴  问题点数:10 回复次数:5 
编译无错,链接出错,求指教
/*学生管理系统*/
#include <iostream>
#include <string>
using namespace std;
void Input_i();
void Scan_i();
struct Input_system
{
    long num;
    string name;
    int highmath;
    int english;
    int cpp;
    int computer;
};
int main()
{
    cout<<"                       ***********欢迎使用学生管理系统***********                          \n"
        <<"                    ***                                          ***                       \n"
        <<"                    ***      1.录入信息.        2.查询信息.      ***                       \n"
        <<"                    ***      3.关于程序.        4.退出.          ***                       \n"
        <<"                    ***                                          ***                       \n"
        <<"                    ***                                          ***                       \n"
        <<"                    ***                      maked by Zhanjixun  ***                       \n";
    int chose;
    cout<<"请选择你要执行的操作:";
    cin>>chose;
    while(1)
    {
        if(chose!=1&&chose!=2&&chose!=3&&chose!=4)
        {
            cout<<"错误!请重新输入:";
            cin>>chose;
        }
        if(chose==1)
        {
            Input_i();
            cout<<"完成录入!\n"
                <<"请选择你要执行的操作:";
            cin>>chose;
        }

        if(chose==2)
            Scan_i();

        if(chose==3)
        {
            cout<<"   本程序用于管理学生成绩信息。可录入\n"
                <<"学生学号、姓名、高数成绩、英语成绩、C++程序设计成绩、计算机导\n"
                <<"论成绩。"<<endl;
            cout<<"请选择你要执行的操作:";
            cin>>chose;
        }

        if(chose==4)
            break;
    }

    if(chose==4)
    {
        cout<<"感谢你的使用,欢迎再次使用。再见!";
        system("pause");
        exit(0);
    }
    return 0;
}
static int i=1;
void Input_i()
{
    Input_system students[80];
    cout<<"请输入学生学号:";
    cin>>students[i].num;
    cout<<"请输入学生姓名:";
    cin>>students[i].name;
    cout<<"请输入该生高数成绩:";
    cin>>students[i].highmath;
    cout<<"请输入该生英语成绩:";
    cin>>students[i].english;
    cout<<"请输入该生C++成绩:";
    cin>>students[i].cpp;
    cout<<"请输入该生导论成绩:";
    cin>>students[i].computer;
    i++;
}

void Scan_i()
{
    extern int i;
    if(i==1)
    {
        //extern chose;
        cout<<"未录入学生信息,无法查询!\n"
            <<"请先录入学生信息!\n";
        //cin>>chose;
    }
    cout<<"请选择查询方式:\n"
        <<"1.按学号.\n"
        <<"2.按姓名.\n";
    int look;
    cin>>look;
    while(1)
    {
        if(look!=1&&look!=2)
        {
            cout<<"错误!请重新选择。";
            cin>>look;
        }
        else break;
    }
    if(look==1)
    {
        extern Input_system student[80];
        cout<<"请输入学号:";
        Input_system scan;
        cin>>scan.num;
        for(i=1;i<80;i++)
            if(student[i].num==scan.num)
            {
                cout<<"学号    姓名    高数成绩    英语成绩    C++成绩    导论成绩";
                cout<<student[i].num<<" "<<student[i].name<<" "<<student[i].highmath<<" "<<student[i].english<<" "<<student[i].cpp<<" "<<student[i].computer<<" ";
                break;
            }
    }
    if(look==2)
    {
        extern Input_system student[80];
        cout<<"请输入姓名:";
        Input_system scan;
        cin>>scan.name;
        for(i=1;i<80;i++)
            if(student[i].name==scan.name)
            {
                cout<<"学号    姓名    高数成绩    英语成绩    C++成绩    导论成绩";
                cout<<student[i].num<<" "<<student[i].name<<" "<<student[i].highmath<<" "<<student[i].english<<" "<<student[i].cpp<<" "<<student[i].computer<<" ";
                break;
            }
    }
}
搜索更多相关主题的帖子: computer english include 管理系统 
2013-11-29 15:45
peach5460
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
来 自:武汉
等 级:贵宾
威 望:30
帖 子:2780
专家分:6060
注 册:2008-1-28
收藏
得分:1 
错误信息在哪?没看到

我总觉得授人以鱼不如授人以渔...
可是总有些SB叫嚣着:要么给代码给答案,要么滚蛋...
虽然我知道不要跟SB一般见识,但是我真的没修炼到宠辱不惊...
2013-11-29 15:49
帅mmmmmm哥
Rank: 1
等 级:新手上路
帖 子:6
专家分:6
注 册:2013-11-3
收藏
得分:0 
回复 2楼 peach5460
编译时候没有错误,链接时候就出现错误。

--------------------Configuration: 学生管理系统 - Win32 Debug--------------------
Compiling...
Skipping... (no relevant changes detected)
学生管理系统.cpp

学生管理系统.obj - 0 error(s), 0 warning(s)

--------------------Configuration: 学生管理系统 - Win32 Debug--------------------
Linking...
学生管理系统.obj : error LNK2001: unresolved external symbol "struct Input_system * student" (?student@@3PAUInput_system@@A)
学生管理系统.obj : error LNK2001: unresolved external symbol "struct Input_system * student" (?student@@3PAUInput_system@@A)
Debug/学生管理系统.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.

学生管理系统.exe - 1 error(s), 0 warning(s)
2013-11-29 16:01
yuccn
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:何方
等 级:版主
威 望:167
帖 子:6815
专家分:42393
注 册:2010-12-16
收藏
得分:9 
为什么写一大堆  extern Input_system student[80];?
不要以为这样就能够读取到main中的那个student了。

通过参数传递~或者用全局变量

我行我乐
公众号:逻辑客栈
我的博客:
https://blog.yuccn. net
2013-11-29 16:01
帅mmmmmm哥
Rank: 1
等 级:新手上路
帖 子:6
专家分:6
注 册:2013-11-3
收藏
得分:0 
回复 4楼 yuccn
好像去掉两个extern就行了,谢谢指教!!
2013-11-29 16:06
ldj34089850
Rank: 2
等 级:论坛游民
帖 子:22
专家分:12
注 册:2013-11-10
收藏
得分:0 
链接出现出错void Input_i();
void Scan_i();
没有定义
2013-11-29 18:35
快速回复:编译无错,链接出错,求指教
数据加载中...
 
   



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

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