LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-04-2005, 02:38 AM   #1
Mistro116@yahoo.com
Member
 
Registered: Sep 2005
Posts: 118

Rep: Reputation: 15
parse error before numeric constant HELPPP


Hey,

I really need help I got this project due tomorrow, and I cant get this stupid thing to compile. Im using xemacs and here is the code:

void ConvertTime (void)
{
printf("Where are you ?\n");

/* Display the five possible foreign locations that the
user may choose from. */
DisplayLocations ();

printf("Your choice :\n");

/* Allow the user to choose one of the five possible
foreign locations from the location menu. */
int locationMenuChoice = GetValidInt
(LONDON, STPETERSBURG);

printf("What time is it ?\n");
printf("hour:\n");

/* Allow the user to choose an hour between MINHOUR, 0,
and MAXHOUR, 23. */
int foreignHour = GetValidInt (MINHOUR, MAXHOUR);

printf("minutes:\n");

/* Allow the user to choose a minute between MINMINUTE,
0, and MAXMINUTE, 59. */
int foreignMinute = GetValidInt (MINMINUTE, MAXMINUTE);

int easternHour;

/* Converts the foreign hour, in 24-hour form, into the
correct Eastern hour, in 24-hour form, and displays
the foreign time in the city selected by the user. */
switch(locationMenuChoice)
{
Case LONDON:
easternHour = ForeignTimeToEastern (foreignHour, LONDONTIME);
printf("%d:%d London time is ", foreignHour, foreignMinute);
break;

Case STOCKHOLM:
easternHour = ForeignTimeToEastern (foreignHour, STOCKHOLMTIME);
printf("%d:%d Stockholm time is ", foreignHour, foreignMinute);
break;

Case TAMPERE:
easternHour = ForeignTimeToEastern (foreignHour, TAMPERETIME);
printf("%d:%d Tampere time is ", foreignHour, foreignMinute);
break;

Case HELSINKI:
easternHour = ForeignTimeToEastern (foreignHour, HELSINKITIME);
printf("%d:%d Helsinki time is ", foreignHour, foreignMinute);
break;

Case STPETERSBURG:
easternHour = ForeignTimeToEastern (foreignHour, STPETERSBURGTIME);
printf("%d:%d St. Petersburg time is ", foreignHour, foreignMinute);
break;
}

/* Converts the Eastern hour into 12-hour form with AM
or PM and displays the Eastern time in 12-hour
form. */
PrintInUSForm (easternHour, foreignMinute);
}

Its giving me the following compiler error:

travel.c: In function `ConvertTime':
travel.c:445: error: `Case' undeclared (first use in this function)
travel.c:445: error: (Each undeclared identifier is reported only once
travel.c:445: error: for each function it appears in.)
travel.c:445: error: parse error before numeric constant
travel.c:450: error: parse error before numeric constant
travel.c:455: error: parse error before numeric constant
travel.c:460: error: parse error before numeric constant
travel.c:465: error: parse error before numeric constant

How do I get this fixed??

Thanks a lot,
Mistro116
 
Old 10-04-2005, 03:19 AM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
C is case-sensitive, meaning "Switch" is not the same as "switch".

Similarly, the case keyword is not capitalized. That's why you get the `Case' undeclared error.


Also, when posting code, use code tags in your message, because it makes the code easier to read. Use the "Code" button above the main text box for messages to insert the code tags for you (or type them yourself). Put the code between the start and end tag to get a nice formatting.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
in gcc compiler error: parse error before string constsnt cynthia_thomas Linux - Networking 1 10-20-2005 01:29 AM
Constant Theme Error dj9928 Linux - Software 1 04-21-2005 02:33 AM
c++ multi-character constant error? azucarmom Programming 4 12-05-2004 07:13 PM
MySQL Numeric Error? nbjayme Programming 9 05-13-2004 07:05 AM
parse error before constant dmaxj Programming 3 06-30-2003 03:07 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration