| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 580 人关注过本帖
标题:请你们谁帮我看看为什么说我标示符未定义,我用c++编写的
只看楼主 加入收藏
李雪莲
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2013-4-1
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
请你们谁帮我看看为什么说我标示符未定义,我用c++编写的
这是我的main函数
#include<iostream>
#include<cstring>
#include"student.h"
#include"birthday.h"
using namespace std;

int  main ()
{

    char name[20],num[20],id[20],sex;
    int year,month,day;

    cin>>year>>month>>day;
    bir student_bir(year,month,day);

    cin>>name>>num>>id>>sex;
    student student_ip(name,num,sex,id);//这里说我student为error C2065: 'student' : undeclared identifier我的这个类在头文件#include"student.h"中 。。。为什么这样说我错了啊!
    student student_ip(student_bir);

    student_ip.show();
   
    return 0;
}

头文件#include"student.h"
#include<iostream>
using namespace std;
#include"birthday.h"
#ifdef _STUDENT_H_
#define _STUDENT_H_
class student{
public:
    student(char *nam,char *nu,char a,char * d);
    student(student &p);
    student(bir p1);
    ~student(){}   
    void show();
private:
    char name[20], number[20],sex,id[20];
    bir p2;
    static  int count;
};
#endif

[ 本帖最后由 李雪莲 于 2013-4-4 16:19 编辑 ]
搜索更多相关主题的帖子: include 标示 
2013-04-01 18:38
卡巴斯
Rank: 2
等 级:论坛游民
帖 子:50
专家分:31
注 册:2012-12-18
收藏
得分:20 
程序代码:
class Program
    {
        class Book:IComparable//继承接口,用来重写方法
        {
            private string bookname;
            private string bookkind;
            private decimal bookprice;
            public string BookName
            {
                set { bookname = value; }
                get { return bookname; }
            }
            public string BookKind
            {
                set { bookkind = value; }
                get { return bookkind; }
            }
            public decimal BookPrice
            {
                set { bookprice = value; }
                get { return bookprice; }
            }
            public int CompareTo(object obj)//重写CompareTo方法,使Book类可以使用数组的排序功能
            {
                Book book = (Book)obj;
                if (this.bookprice < book.bookprice)
                    return -1;
                if (this.bookprice > book.bookprice)
                    return 1;
                return 0;
            }
        }

 static void Main(string[] args)
        {
            {
                int[] price=new int[]{10,40,30,50,10};
                Book[] books = new Book[5];//定义一个book类型的数组
                for (int i = 0; i < books.Length;i++ )//为数组赋值,这里只写了价格,可以自己添加分类和书名
                {
                    books[i]=new Book() ;
                    books[i].BookPrice = price[i];
                }
                Array.Sort(books);//进行排序
                foreach (Book book in books)
                {
                    Console.WriteLine(book.BookPrice);
                }
}
2013-04-01 22:34
李雪莲
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2013-4-1
收藏
得分:0 
回复 2楼 卡巴斯
谢谢!!
2013-04-01 22:55
快速回复:请你们谁帮我看看为什么说我标示符未定义,我用c++编写的
数据加载中...
 
   



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

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