none
Error C2143: missing ';' before 'type' ? help please!

    Question

  • This is for a school project, very beginner. But I am getting these errors:
     :error C2143: syntax error : missing ';' before 'type'
    :error C2143: syntax error : missing ';' before 'type'
     :fatal error C1075: end of file found before the left brace '{'

    and I am lost on how to fix them, here is my code, sorry if it's super messy and confusing. Thanks!


    #include <stdio.h>
    int main(void);

     

    void menu(void);

    int getChoice(void);

     

    void calendarToJulian(void);

    void getCalendarDate(int *month, int *day, int *year, int *juliandate);

     
    int julianToCalendar(void);


    int main(void) {

        int choice;

     

        do {

            choice = getChoice();

            switch (choice) {

                case 1 : calendarToJulian(); break;

                case 2 : julianToCalendar(); break;

                case 3 : break;

            }

        }

        while (choice != 3);

        return 0;

    }

    int calendertoJulian(void) {
        int month, day, year, juliandate;
        printf("Enter month, day, year");
     scanf_s("%d%d%d/n", &month, &day, &year);
         printf("julian date %d/%d\n,", &juliandate, &year);
         return 0; }

    int getcalenderdate(int month, int day, int year, int juliandate)
     { if (month = 1) {
    juliandate = month - 1 + day;
     } if (month = 2) {
        juliandate = month - 1 + 31 + day;
     } if (month = 3){
         juliandate = month - 1 + 58 + day;
     }if (month = 4){
         juliandate = month - 1 + 88 + day;
     }if (month = 5){
         juliandate = month - 1 + 117 + day;
     }if (month = 6){
         juliandate = month - 1 + 147 + day;
     }if (month = 7){
         juliandate = month - 1 + 176 + day;
     }if (month = 8){
         juliandate = month - 1 + 206 + day;
     }if (month = 9){
         juliandate = month - 1 + 236 + day;
     }if (month = 10){
         juliandate = month - 1 + 265 + day;
     }if (month = 11){
         juliandate = month - 1 + 295 + day;
     } if (month = 12){
         juliandate = month - 1 + 324 + day;
     } return juliandate;

     int juliantocalender(void)
         int juliandate, year;
         
     {printf("Enter Julian date");
     scanf("%d%d", juliandate, year);
     {if (juliandate < 31){
      printf("calender date = 1/%d\n", &juliandate, &year);
     }if ((31 < juliandate < 59) - 31);{
        printf("calender date = 2/%d/%d\n", &juliandate, &year);
         }if ((59 < juliandate < 90) - 59);{
        printf("calender date = 3/%d/%d\n", &juliandate, &year);
         }if ((90 < juliandate < 120) - 90);{
        printf("calender date = 4/%d/%d\n", &juliandate, &year);
         }if ((120 < juliandate < 151) - 120);{
        printf("calender date = 5/%d/%d\n", &juliandate, &year);
         }if ((151 < juliandate < 181) - 151);{
        printf("calender date = 6/%d/%d\n", &juliandate, &year);
         }if ((181 < juliandate < 212) - 181);{
        printf("calender date = 7/%d/%d\n", &juliandate, &year);
         }if ((212 < juliandate < 243) - 212);{
        printf("calender date = 8/%d/%d\n", &juliandate, &year);
         }if ((243 < juliandate < 273) - 243);{
        printf("calender date = 9/%d/%d\n", &juliandate, &year);
         }if ((273 < juliandate < 304) - 273);{
        printf("calender date = 10/%d/%d\n", &juliandate, &year);
         }if ((304 < juliandate < 334) - 304);{
        printf("calender date = 11/%d/%d\n", &juliandate, &year);
         }if ((334 < juliandate < 365) - 334){
        printf("calender date = 12/%d/%d\n", &juliandate, &year);}
        return 0;}
       
       
       
       
       
       
       
       
       
    Friday, October 17, 2008 11:42 PM

Answers

  • There are a few basic skills an effective programmer needs.  The first and foremost one is tidiness.  Write your code neatly, properly indented, commented and with a consistent style of naming your variables.  Do that and you'll easily find your problem with the missing and misplaced braces and the incorrectly spelled function names.  There are a few other problems, but figuring them out yourself is an important part of learning how to program too.
    Hans Passant.
    Saturday, October 18, 2008 12:30 AM
    Moderator

All replies

  • There are a few basic skills an effective programmer needs.  The first and foremost one is tidiness.  Write your code neatly, properly indented, commented and with a consistent style of naming your variables.  Do that and you'll easily find your problem with the missing and misplaced braces and the incorrectly spelled function names.  There are a few other problems, but figuring them out yourself is an important part of learning how to program too.
    Hans Passant.
    Saturday, October 18, 2008 12:30 AM
    Moderator
  • On top of that, get a book on C, such as K&R2.

    Quick tip: = is not the same operator as ==. Read the aforementioned book for more info.
    Saturday, October 18, 2008 12:38 AM