Jump to content
  • Advertisement
Sign in to follow this  
Nanook

compile error

This topic is 3856 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

can anyone tell me why I get the following msg when I try to compile? D:\progs\Borland\BCC55\Bin>bcc32 code.c Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland code.c: Error E2293 code.c 14: ) expected *** 1 errors in Compile ***
#include <stdio.h>

void print_menu_options()
{
		printf("Menu options: \n");
		printf("a - Print my Name \n");
		printf("b - Print my tutorial name \n");
		printf("c - Count numbers \n");
		printf("q - Quit \n");

		return;
}

void get_input(char &c)
{
	scanf("%c%*c", &c);

	return;
}


void check_input(char input)
{
	switch(input)
	{
		case 'a':
		case 'A':
			printf("My name is Terje! \n");
			break;
		case 'b':
		case 'B':
			printf("My tutorial time is Wednesdays at 0930 \n");
			break;
		case 'c':
		case 'C':
			read_num_and_process();
			break;
		case 'q':
		case 'Q':
			printf("You decided to quit \n");
			break;
		default:
			printf("Wrong input \n");
	}

	return;
}

void read_num_and_process()
{
	int num
	printf("Enter a number between 1 and 50");
	scanf("%d%*c", &num);

	if ((num < 1) || (num > 50))
		printf("Wrong input.");
	else
	{
		for(i = 0; i < num; i++)
			printf("%d", i);
	}

	return;
}

int main()
{
	char input;

	do
	{
		print_menu_options();		

		get_input(input);

		check_input(input);
	}while((input != q) || (input != Q))

	return(0);
}




[Edited by - Nanook on April 1, 2008 9:09:29 AM]

Share this post


Link to post
Share on other sites
Advertisement
Probably because you're trying to use a reference in a C source file. C doesn't have references.

Share this post


Link to post
Share on other sites
aah.. thats right.. my teacher told us to save as .cpp for this one.. remember now.. cheers :)

Share this post


Link to post
Share on other sites
I fixed up some more errors, but I cant figure out this one;

D:\progs\Borland\BCC55\Bin>bcc32 code.cpp
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
code.cpp:
Error E2378 code.cpp 78: Do-while statement missing ; in function main()
*** 1 errors in Compile ***

my main look like this;


int main()
{
char input;

do
{
print_menu_options();

get_input(input);

check_input(input);
}while((input != 'q' || input != 'Q'))

return(0);
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!