I dont know.. why MVC++ teasing me.....
trying to use list container.. but giving me the error...
see code of main.cpp I have mentioned errors...
and also code of student class is next to main.cpp
project in self extractor form is attached..
----------main.cpp-------------
code of student.cppCode:#include <iostream.h> #include <conio.h> #include <list.h> #include "Menu.h" // for the Menu function... //list<student> stlist;//giving me error here...??? //If I uncommented .. the error is "error C2143: syntax error : missing ';' before '<'" //#include "student.h" #include "student.cpp" int main(void) { Menu(); //to call menu function defined in Menu.h list<student> stlist;//giving me error here...tooo??? return 0; //error is "undeclared identifier." }
Code:// student.cpp: implementation of the student class. // ////////////////////////////////////////////////////////////////////// #include "student.h" #include <iostream.h> #include <string.h> ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// student::student() : rono(0), phno(0) { setname("Undefined name."); setaddress ( "Undefined Address." ); //default constructor... } student::~student() { } /****************************************************************** Defination / Implementation of student class member functions. /*****************************************************************/ void student::setrono(long int rn) { rono = rn; } long int student::getrono(void) { return rono; } void student::setphno(long int pn) { rono = pn; } long int student::getphno(void) { return phno; } void student::setname(char *na) { strcpy( name,na); } char* student::getname(void) { return name; } void student::setaddress(char* ad) { strcpy ( address, ad); } char* student::getaddress(void) { return address; }
code of student.h
Code:/*****************Purpose of the Class...**************************/ /* Class student's object handles the roll no(long int rono), /* phone no (long int phno), name (char* name) and /* address (char* address) of a student.. /*****************************************************************/ ////////////////////////Interface of the Class..../////////////// class student { private: long int rono, phno; char *name, *address; public: student(); //constructor....heehehehheh I know it.. :D virtual ~student(); //Destructor.....but virtual /*//////////////////to set and get "Roll no".///////*/ long int getrono(void); void setrono(long int); /////////////////////////////////////////////////// ////////////////////to set and get "Phone no"/////// long int getphno(void); void setphno(long int); /////////////////////////////////////////////////// ///////////////////to set and get "Name".////////// char* getname(void); void setname(char* ); /////////////////////////////////////////////////// ////////////////////to set and get "Address"/////// char* getaddress(void); void setaddress(char* ); //////////////////////////////////////////////////*/ };



LinkBack URL
About LinkBacks


