i have a problem regarding functions. this leap year code is frustrating because it will always give me "not a leap year" whenver i entered a year:
#include <iostream>
using namespace std;
int get_input();
bool CheckLeapYear(int);
int main()
{
int year,x;
char key;
do {
year=get_input();
cout<<CheckLeapYear(x)<<endl;
cout<<"Press 'y' to continue: ";
cin>>key;
}
while (key=='Y' || key=='y');
system("pause");
return 0;
}
int get_input()
{
int x;
cout<<"\nPlease enter a year : ";
cin>>x;
return x;
}
bool CheckLeapYear(int x)
{
if (x % 400==0 || x % 4==0 && x % 100!=0)
cout<<"\nThe year is a leap year\n"<<endl;
else
cout<<"\nThe year is a not leap year\n"<<endl;
}
and if you run it, theres a 192 value and i don't even know where does it comes from...teach me something about functions.....help me please...and please don't give me direct answer, i need to learn functions....