• Advertisement
Sign in to follow this  

compile error

This topic is 3611 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
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
You need a semi-colon after the while() in a do/while statement.

Share this post


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

  • Advertisement