#include <stdio.h>
#include <c.h>

//int main (int argc, const char * argv[]);

switch (1066)
{
case 1066
printf( " Battle of Hastings");
break;

case 1492
printf( "columbus sailed to some place" );
break;

case 1776
printf( "The decleration of indipendence was written and signed")
break;

defult:
printf( "something happend but I forget what");



 

 return 0;}

//thats what isn't working pleze help me get it to work
//why is there a
//parse error before "switch"

Why is main commented out? and after you comment it out, why does it have a semicolon? And why are there no colons after each case statement? And why is default spelled wrong?

main was commented out to see if it was a missing or wrongly placed parentheses.

as for default being spelled wrong ( typo )
I fixed it but it still doesent work

#include <stdio.h>
#include <c.h>

int main (int argc, const char * argv[])

switch (1066)
{
case 1066
printf( " Battle of Hastings");
break;

case 1492
printf( "columbus sailed to some place" );
break;

case 1776
printf( "The declaration of independence was written and signed")
break;

default:
printf( "something happened but I forget what");



 

 return 0;}

Too lazy - here's the corrected code:

#include <stdio.h>
int main (int argc, char * argv[])
{
		switch (1066)
		{
		case 1066:
		printf( "Battle of Hastings\n");
		break;
		case 1492:
		printf( "columbus sailed to some place\n" );
		break;
		case 1776:
		printf( "The declaration of independence was written and signed\n");
		break;
		default:
		printf( "something happened but I forget what\n");
		}
 
return 0;
}
 
./Temp
Battle of Hastings

Probably because 1066 is always 1066.

thanks
i was missing mainly
the concept of
:
and a ;
and a another { }
thanks

Now the next step is to make the user pass in a year at the command line, etc.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.