and the CLASSI.cpp basicly the functions that the class contains and main.cpp main function that creating object
with this class and uses it but when i compile i got error (from which i understand the CLASSI.cpp dont see class in header file) what can i do ?

here is the codes:
CLASSI.h
#ifndef _CLASSI_H_
#define _CLASSI_H_
#include <iostream>
using namespace std;
#include <conio.h>
#include <stdio.h>
class Date
{
private:
int day,month,year;
public:
Date(int d,int m,int y){day=d;month=m;year=y;}
int LeapYear ();
int DaysInMonth ();
int Day(){return day;}
void PrintDate ();
void IncreaseDate ();
void PrintLeap ();
};
#endif
CLASSI.cpp
#include "CLASSI.h"
int Data::LeapYear ()
{
if (year%4==0 || year%400==0)
{
return 1;
}
else {return 0;}
}
int Data::DaysInMonth ()
{
int i;
int m=1;
for(i=0;i<month;i++)
{
if(m==8){m++;}
m++ ;
}
if(m==2 && LeapYear()==1){return 29;}
else {if(m==2){return 28;}
else{return (30+(m%2));}
}
}
void Data::PrintDate ()
{
cout<<"Date: "<<day<<"/"<<month<<"/"<<year<<endl;
}
void Data::IncreaseDate ()
{
if(day==DaysInMonth()){day=1;month++;if(month==13){month=1;}}else{day++;}
}
void Data::PrintLeap ()
{
if(LeapYear ()) {cout<<"- This year is a 'Leap Year'"<<<endl; }
}
Main.cpp
#include "CLASSI.h"
int main ( )
{
Date newYearsDay (1,1,2000);
newYearsDay.PrintDate ();
newYearsDay.IncreaseDate ();
newYearsDay.PrintDate ();
newYearsDay.PrintLeap ();
Date d (30,3,2006);
d.IncreaseDate ();
d.PrintDate ();
d.PrintLeap ();
for (Date dd(25,2,1992); dd.Day()<3 || dd.Day()>10; dd.IncreaseDate())
dd.PrintDate ();
return 0;
}
Error list
Build Log
Build started: Project: HW5_1, Configuration: Debug|Win32
Command Lines
Creating temporary file "c:\Documents and Settings\Andrey\My Documents\Visual Studio 2008\Projects\HW5_1\HW5_1\Debug\RSP00007C20721844.rsp" with contents
[
/Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MDd /Fo"Debug\\" /Fd"Debug\vc90.pdb" /W3 /c /ZI /TP ".\CLASSI.cpp"
]
Creating command line "cl.exe @"c:\Documents and Settings\Andrey\My Documents\Visual Studio 2008\Projects\HW5_1\HW5_1\Debug\RSP00007C20721844.rsp" /nologo /errorReport:prompt"
Output Window
Compiling...
CLASSI.cpp
c:\documents and settings\andrey\my documents\visual studio 2008\projects\hw5_1\hw5_1\classi.cpp(7) : error C2653: 'Data' : is not a class or namespace name
c:\documents and settings\andrey\my documents\visual studio 2008\projects\hw5_1\hw5_1\classi.cpp(9) : error C2065: 'year' : undeclared identifier
c:\documents and settings\andrey\my documents\visual studio 2008\projects\hw5_1\hw5_1\classi.cpp(9) : error C2065: 'year' : undeclared identifier
c:\documents and settings\andrey\my documents\visual studio 2008\projects\hw5_1\hw5_1\classi.cpp(16) : error C2653: 'Data' : is not a class or namespace name
c:\documents and settings\andrey\my documents\visual studio 2008\projects\hw5_1\hw5_1\classi.cpp(20) : error C2065: 'month' : undeclared identifier
c:\documents and settings\andrey\my documents\visual studio 2008\projects\hw5_1\hw5_1\classi.cpp(35) : error C2653: 'Data' : is not a class or namespace name
c:\documents and settings\andrey\my documents\visual studio 2008\projects\hw5_1\hw5_1\classi.cpp(37) : error C2065: 'day' : undeclared identifier
c:\documents and settings\andrey\my documents\visual studio 2008\projects\hw5_1\hw5_1\classi.cpp(37) : error C2065: 'month' : undeclared identifier
c:\documents and settings\andrey\my documents\visual studio 2008\projects\hw5_1\hw5_1\classi.cpp(37) : error C2065: 'year' : undeclared identifier
c:\documents and settings\andrey\my documents\visual studio 2008\projects\hw5_1\hw5_1\classi.cpp(39) : error C2653: 'Data' : is not a class or namespace name
c:\documents and settings\andrey\my documents\visual studio 2008\projects\hw5_1\hw5_1\classi.cpp(41) : error C2065: 'day' : undeclared identifier
c:\documents and settings\andrey\my documents\visual studio 2008\projects\hw5_1\hw5_1\classi.cpp(41) : error C2065: 'day' : undeclared identifier
c:\documents and settings\andrey\my documents\visual studio 2008\projects\hw5_1\hw5_1\classi.cpp(41) : error C2065: 'month' : undeclared identifier
c:\documents and settings\andrey\my documents\visual studio 2008\projects\hw5_1\hw5_1\classi.cpp(41) : error C2065: 'month' : undeclared identifier
c:\documents and settings\andrey\my documents\visual studio 2008\projects\hw5_1\hw5_1\classi.cpp(41) : error C2065: 'month' : undeclared identifier
c:\documents and settings\andrey\my documents\visual studio 2008\projects\hw5_1\hw5_1\classi.cpp(41) : error C2065: 'day' : undeclared identifier
c:\documents and settings\andrey\my documents\visual studio 2008\projects\hw5_1\hw5_1\classi.cpp(43) : error C2653: 'Data' : is not a class or namespace name
c:\documents and settings\andrey\my documents\visual studio 2008\projects\hw5_1\hw5_1\classi.cpp(45) : error C2059: syntax error : '<'
Results
Build log was saved at "file://c:\Documents and Settings\Andrey\My Documents\Visual Studio 2008\Projects\HW5_1\HW5_1\Debug\BuildLog.htm"
HW5_1 - 18 error(s), 0 warning(s)

New Topic/Question
Reply




MultiQuote





|