Damnatory
10-18-2003, 07:17 PM
This is probably a stupid question, but the only error I am getting keeps the program from compiling stating that: " To few parameters in call to DayCount( int, int )
Heres the code, and I'll bold the call..
#include <iomanip.h>
#include <iostream.h>
#include <conio.h>
#include "calender.h"
int main( )
{
int m;
int y;
int xLeapyear;
int days;
char *monthName[12] = {
"January","February","March","April","May","June","July","August",
"September","October","November","December" };
cout << "Enter the Month in question by its value (Ex. 1-12): " << endl;
cin >> m;
if ( m <= 0 || m >= 13 ) {
cout << "Error, month value invalid." << endl;
getch();
return 1;
}//endif
cout << "Please enter the year in question (Ex. 2000(xxxx))" << endl;
cin >> y;
if ( y < 1582 ) {
cout << "Years before 1582 were all Leap Years, try again." << endl;
getch();
return 1;
}//endif
if ( m > 0 && m < 13 ) {
days = DayCount( m );
xLeapyear = LeapYear(y);
if ( m == 2 && xLeapyear == 1 ) {
days = 29;
}else{
if ( m == 2 ) {
days == 28;
}//endif
}//endif
cout << "There are " << days << " days in " << monthName[m-1] << " " << y << "." <<endl;
}//endif
getch();
return 0;
}//endmn
The Function
///////////////////////////////////////////////////////////////////////////
// // Pre:
// LeapYear //
// // Post:
//////////////
int LeapYear( int year )
{
if ( (year % 4 ==0 && year % 100 != 0) || year % 400 == 0 ) {
return 1;
}//endif
return 0;
}//endfn LeapYear
///////////////////////////////////////////////////////////////////////////
// // Pre:
// DayCount //
// // Post:
//////////////
int DayCount( int month )
{
if ( month >= 8 ) {
if ( month % 2 ) {
return 30;
}else{
return 31;
}//endif
}else{
if ( month % 2 ) {
return 31;
}else{
return 30;
}//endif
}//endif
}//endfn DayCount
And the Header, if this might help.
#ifndef _LEAPYEAR_H
#define _LEAPYEAR_H
int LeapYear( int year );
int DayCount( int month, int year );
#endif _LEAPYEAR_H
Anyone know how to get rid of that error?
Amarjit?
Heres the code, and I'll bold the call..
#include <iomanip.h>
#include <iostream.h>
#include <conio.h>
#include "calender.h"
int main( )
{
int m;
int y;
int xLeapyear;
int days;
char *monthName[12] = {
"January","February","March","April","May","June","July","August",
"September","October","November","December" };
cout << "Enter the Month in question by its value (Ex. 1-12): " << endl;
cin >> m;
if ( m <= 0 || m >= 13 ) {
cout << "Error, month value invalid." << endl;
getch();
return 1;
}//endif
cout << "Please enter the year in question (Ex. 2000(xxxx))" << endl;
cin >> y;
if ( y < 1582 ) {
cout << "Years before 1582 were all Leap Years, try again." << endl;
getch();
return 1;
}//endif
if ( m > 0 && m < 13 ) {
days = DayCount( m );
xLeapyear = LeapYear(y);
if ( m == 2 && xLeapyear == 1 ) {
days = 29;
}else{
if ( m == 2 ) {
days == 28;
}//endif
}//endif
cout << "There are " << days << " days in " << monthName[m-1] << " " << y << "." <<endl;
}//endif
getch();
return 0;
}//endmn
The Function
///////////////////////////////////////////////////////////////////////////
// // Pre:
// LeapYear //
// // Post:
//////////////
int LeapYear( int year )
{
if ( (year % 4 ==0 && year % 100 != 0) || year % 400 == 0 ) {
return 1;
}//endif
return 0;
}//endfn LeapYear
///////////////////////////////////////////////////////////////////////////
// // Pre:
// DayCount //
// // Post:
//////////////
int DayCount( int month )
{
if ( month >= 8 ) {
if ( month % 2 ) {
return 30;
}else{
return 31;
}//endif
}else{
if ( month % 2 ) {
return 31;
}else{
return 30;
}//endif
}//endif
}//endfn DayCount
And the Header, if this might help.
#ifndef _LEAPYEAR_H
#define _LEAPYEAR_H
int LeapYear( int year );
int DayCount( int month, int year );
#endif _LEAPYEAR_H
Anyone know how to get rid of that error?
Amarjit?