LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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
 
LinkBack Search this Thread
Old 09-02-2005, 07:57 PM   #1
boxerboy
Member
 
Registered: Jul 2005
Distribution: ubuntu5.04, ubuntu5.10, suse9.3, mandrake10.1, mandriva2006(beta), FC1-4, redhat9.0, debian sarge
Posts: 519

Rep: Reputation: 32
problem line 26 stray ' so it says.....


here the source code:
Code:
/* Theater lobby snack bar program */

#include <stdio.h>

int main()
{
	char c;

	printf("Please make your treat selection:\n");
	printf("1 - Beverage.\n");
	printf("2 - Candy.\n");
	printf("3 - Hot Dog.\n");
	printf("4 - Popcorn.\n");
	printf("Your choice:");

/* figure out what they typed in. */

	c=getchar();
	switch(c)
	{

	case '1':
		printf("Beverage\nThat will be $8.00\n");
		break;
	case '2':
`		printf("Candy\nThat will be $5.50\n");
		break;
	case '3':
		printf("Hot Dog\nThat will be $10.00\n");
		break;
	case '4':
		printf("Popcorn\nThat will be $7.50\n");
		break;
	default:
		printf("That is not a proper selection.\n");
		printf("I'll assume you're just not hungry.\n");
		printf("Can I help whoever's next?\n");
	}
	return(0);
}
ok heres what im getting after i compile it :
Code:
[boxerboy@localhost ~]$ gcc lobby2.c -o lobby2
lobby2.c: In function ‘main’:
lobby2.c:26: error: stray ‘`’ in program
[boxerboy@localhost ~]$
please help on this to me it all looks rightso im not real sure.
 
Old 09-02-2005, 08:25 PM   #2
aluser
Member
 
Registered: Mar 2004
Location: Massachusetts
Distribution: Debian
Posts: 557

Rep: Reputation: 42
er, that's because there's a stray ` in your program : )

lefthand column, after the "case '2':" line
 
Old 09-02-2005, 08:31 PM   #3
boxerboy
Member
 
Registered: Jul 2005
Distribution: ubuntu5.04, ubuntu5.10, suse9.3, mandrake10.1, mandriva2006(beta), FC1-4, redhat9.0, debian sarge
Posts: 519

Original Poster
Rep: Reputation: 32
thank you i couldnt see it on the text editer but when i looked it over in the code i gave you i see it now thank you.
 
Old 09-03-2005, 04:42 PM   #4
eddiebaby1023
Member
 
Registered: May 2005
Posts: 378

Rep: Reputation: 32
Always read your error messages - they often point you right at the problem!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Firestarter Stray Icon problems morrolan Linux - General 1 09-20-2005 08:02 PM
Stray at line number vipinsharma Programming 1 05-21-2004 09:27 AM
Stray '/250' in program Sneddo Programming 5 10-10-2003 08:44 AM
Stray '/250' in program Sneddo Linux - Software 0 08-08-2003 03:24 AM
System time goes stray on notebook Tinkster Linux - Hardware 2 02-25-2003 02:27 AM


All times are GMT -5. The time now is 02:48 PM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration