Average Rainfall Program Errors

This is a discussion on Average Rainfall Program Errors within the C Programming forums, part of the General Programming Boards category; I had some help writing this program that gives the average rainfall, it says 1 error but there appears to ...

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    2

    Average Rainfall Program Errors

    I had some help writing this program that gives the average rainfall, it says 1 error but there appears to be 3...could someone correct it for me, here is my program and exactly what the compiler said:


    #include <stdio.h>;

    int main(void)
    {
    int april = 12, may = 14, june = 8;

    printf("The average Rainfall for April is %d april\n", april);
    printf("The average Rainfall for May is %d may\n", may);
    printf("The average Rainfall for June is %d june\n", june);
    printf("The average Rainfall for all three months is %f.\n", ( (float)(april + may + june) / 3) );
    }
    return 0;


    --------------------Configuration: rainfall - Win32 Debug--------------------
    Compiling...
    rainfall.cpp
    c:\documents and settings\arcview1\desktop\rainfall.cpp(1) : warning C4067: unexpected tokens following preprocessor directive - expected a newline
    C:\Documents and Settings\arcview1\Desktop\rainfall.cpp(11) : warning C4508: 'main' : function should return a value; 'void' return type assumed
    C:\Documents and Settings\arcview1\Desktop\rainfall.cpp(12) : error C2143: syntax error : missing ';' before 'return'
    Error executing cl.exe.

    rainfall.exe - 1 error(s), 2 warning(s)




    thanks for your time and help,
    James

  2. #2
    Green Member Cshot's Avatar
    Join Date
    Jun 2002
    Posts
    892
    1)#include <stdio.h>;
    Leave out the semicolon.

    2)
    }
    return 0;
    Put return 0; inside your main function.
    Try not.
    Do or do not.
    There is no try.

    - Master Yoda

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Client-server system with input from separate program
    By robot-ic in forum Networking/Device Communication
    Replies: 3
    Last Post: 01-16-2009, 02:30 PM
  2. Errors in Dev-C++ program
    By sinking2008 in forum C Programming
    Replies: 5
    Last Post: 05-15-2008, 09:00 AM
  3. List of Errors in C# program.
    By arcaine01 in forum C# Programming
    Replies: 1
    Last Post: 05-09-2008, 02:37 PM
  4. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 10:17 PM
  5. program error
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 11-15-2001, 09:20 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21