Help with a program

Discussion in 'Programming General' started by FreakNasty188, Oct 4, 2011.

Help with a program
  1. Unread #1 - Oct 4, 2011 at 10:51 PM
  2. FreakNasty188
    Joined:
    Jul 15, 2011
    Posts:
    174
    Referrals:
    0
    Sythe Gold:
    0

    FreakNasty188 Active Member

    Help with a program

    Hey guys I'm writing a basic C++ program for my programming class. Basically the user inputs their numerical birth month and it tells them what season they were born in. I have the code written, but I'm getting these errors.


    Error 1 error C2660: 'season' : function does not take 1 arguments c:\users\kevin\desktop\cmpsc101\10_4_11\10_4_11\p1.cpp 20

    And


    Error 2 error C2447: '{' : missing function header (old-style formal list?) c:\users\kevin\desktop\cmpsc101\10_4_11\10_4_11\p1.cpp 24

    And


    3 IntelliSense: expected a declaration c:\users\kevin\desktop\cmpsc101\10_4_11\10_4_11\p1.cpp 24

    Here's my program:

    Anyone think they can help?
     
  3. Unread #2 - Oct 4, 2011 at 11:15 PM
  4. blindkilla
    Joined:
    Jun 22, 2005
    Posts:
    1,896
    Referrals:
    0
    Sythe Gold:
    6
    Discord Unique ID:
    282000633404456960
    Discord Username:
    sogord

    blindkilla Guru
    $25 USD Donor New

    Help with a program

    In your prototype definitions for the functions you forgot to specify that the function season takes an integer as a parameter.

    The header should look like this:
    Code:
    #include <iostream>
    using namespace std;
    
    void birthMonth();
    void season(int);
    
     
  5. Unread #3 - Oct 4, 2011 at 11:18 PM
  6. FreakNasty188
    Joined:
    Jul 15, 2011
    Posts:
    174
    Referrals:
    0
    Sythe Gold:
    0

    FreakNasty188 Active Member

    Help with a program

    Ok thanks that got rid of one of the errors, but I'm getting these 2 still:


    Error 1 error C2447: '{' : missing function header (old-style formal list?) c:\users\kevin\desktop\cmpsc101\10_4_11\10_4_11\p1.cpp 24

    And


    2 IntelliSense: expected a declaration c:\users\kevin\desktop\cmpsc101\10_4_11\10_4_11\p1.cpp 24

    Any ideas?
     
  7. Unread #4 - Oct 4, 2011 at 11:20 PM
  8. blindkilla
    Joined:
    Jun 22, 2005
    Posts:
    1,896
    Referrals:
    0
    Sythe Gold:
    6
    Discord Unique ID:
    282000633404456960
    Discord Username:
    sogord

    blindkilla Guru
    $25 USD Donor New

    Help with a program

    On line 23 you have a semi colon at the end of your function delcaration, you don't need it there.

    Code:
    void season (int month);
    {
    	if (month < 1)
    		cout << "Invalid birth month";
    	else if (month <= 3)...
    ^seen there on the first line, needs to be removed.
     
  9. Unread #5 - Oct 4, 2011 at 11:22 PM
  10. FreakNasty188
    Joined:
    Jul 15, 2011
    Posts:
    174
    Referrals:
    0
    Sythe Gold:
    0

    FreakNasty188 Active Member

    Help with a program

    Thanks so much man! I feel stupid now lol they were stupid mistakes. Thanks though!
     
< Checkers | C++ Tutorial in depth >

Users viewing this thread
1 guest


 
 
Adblock breaks this site