Help with leap Year prgram please

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <cstdlib>
#include <iostream>
#include <cmath>

using namespace std;
bool leapYear();
int Year;


int main(int argc, char *argv[])
{
    // intro to the program.
    cout << "Let's see if a year is a Leap-year, shall we?" << endl;
    // asking for the year.
    cout << "Please enter in a year" << endl;
    // user enters the year.
    cin >> Year;
    leapYear();
    
    
    system("PAUSE");
    return EXIT_SUCCESS;
}

// calculating if the year is a leap-year
bool leapYear ()
{
    if ((( Year % 4 == 0) && (! ( Year % 100 == 0))) || (( Year % 4 == 0) && (! ( Year % 100 == 0))&&( Year % 400 == 0))) ;
{    //return true;
       cout << "It is a Leap-year!" << endl;
  
}
    else
{
        //return false;
       cout << "Sorry... it is not a Leap-year..." << endl;
     
     }
 }





errors :
33 expected primary-expression before "else"
33 expected `;' before "else"

can someone help me out please?
Last edited on
I edited it to this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <cstdlib>
#include <iostream>
#include <cmath>

using namespace std;

/* Write a program that determines if a year is a leap year. 
The program calls a function that finds out whether the year is a leap year and returns a Boolean value (true or false) accordingly.

There are two ways a year can be a leap year:
1. A year will be a leap year if it is divisible by 4 and not by 100.
2. If a year is divisible by 4 and also by 100, it is not a leap year unless it is also divisible by 400.

Thus years such as 1996, 1992, 1988 and so on are leap years because they are divisible by 4 but not by 100.
 For century years, the 400 rule is important. 
 Thus, century years 1900, 1800 and 1700 while all still divisible by 4 are also exactly divisible by 100.
  As they are not further divisible by 400, they are not leap years.
  
You must write one logical expression to represent this information, 
    so you need to think about this in terms of of ands (&&) and ors (||).
Make sure that your code is indented, 
     spaced and commented correctly so that you don’t drive yourself nuts when you have to look at it (or I have to look at it).
Include the first three steps of the software development method. 
Remember in step 3 to clearly show the difference between the design for main and the design for any functions that you are using.
You must show the control structures clearly. 
I have posted an example in the Resources section with selection in it so that you can see how to show this part.

You can test your program at http://www.dataip.co.uk/Reference/LeapYear.php
*/


// declaring 
bool leapYear( int );
int Year;


int main(int argc, char *argv[])
{
    // intro to the program.
    cout << "Let's see if a year is a Leap-year, shall we?" << endl;
    // asking for the year.
    cout << "Please enter in a year" << endl;
    // user enters the year.
    cin >> Year;
    
    if (leapYear ( Year))
       cout << "It is a Leap-year!" << endl;
    else
        cout << "Sorry... it is not a Leap-year..." << endl;
    
    system("PAUSE");
    return EXIT_SUCCESS;
}

// calculating if the year is a leap-year
bool leapYear (int)
{
    if ((( Year % 4 == 0) && (! ( Year % 100 == 0))) || (( Year % 4 == 0) && (! ( Year % 100 == 0))&&( Year % 400 == 0))) ;
     return true;
      
    else
        return false;
       
     
     
 }


and getting errors:
In function `bool leapYear(int)':
61 expected primary-expression before "else"
61 expected `;' before "else"
Remove the ; after the if condition in leapYear ;)
Topic archived. No new replies allowed.