Now im getting Declaration Syntax Error on line 155. Please help need urgent .

#include <stdio.h>
#include <conio.h>
#include<process.h>
#include<dos.h>
void graph();
void foo(){
int a,b;
clrscr();

gotoxy(27,12);textcolor(12);cprintf(" ");
gotoxy(40,14);textcolor(12);cprintf(" ");
gotoxy(29,16);textcolor(12);cprintf("  ");
for(a=1;a<=72;a++){
gotoxy(5+a,2);printf("Í");
gotoxy(5+a,23);printf("Í");
}
for(b=1;b<=20;b++){
gotoxy(5,2+b);printf("º");
gotoxy(78,2+b);printf("º");
}
for(int s=1; s<=3;s++){
gotoxy(41,2+s);printf("º"); }
for(int o=1;o<=72;o++){
gotoxy(5+o,5);printf("Í");
}
gotoxy(5,2);printf("É");
gotoxy(78,2);printf("»");
gotoxy(5,23);printf("È");
gotoxy(78,23);printf("¼");
gotoxy(41,2);printf("Ë");
gotoxy(5,5);printf("Ì");
gotoxy(78,5);printf("¹");
gotoxy(41,5);printf("Ê");


getche();


getche();

graph();
}
void graph()
{
clrscr();
int choice;
char z,m;

 gotoxy (12,12);textcolor(4+BLINK); cprintf("LOADING:");
 for(m=1;m<=50;m++){
 gotoxy(19+m,12);textcolor(RED);cprintf("²");
 }for (z=1;z<=50;z++){
 gotoxy(19+z,12);textcolor(GREEN);cprintf("Û");
 delay(40);
 }clrscr();
gotoxy(27,3);textcolor(12);cprintf(" ");
gotoxy(40,4);textcolor(12);cprintf(" ");
gotoxy(29,5);textcolor(12);cprintf(" ");

for(int g=1;g<=72;g++){
gotoxy(5+g,2);printf("Í");
gotoxy(5+g,23);printf("Í");
}
for(int v=1;v<=20;v++){
gotoxy(5,2+v);printf("ߺ");
gotoxy(78,2+v);printf("ºß");
}
for(int k=1; k<=3;k++){
gotoxy(41,2+k);printf(""); }
for(int p=1;p<=72;p++){
gotoxy(5+p,6);printf("Í");
}
gotoxy(5,2);textcolor(GREEN);cprintf(" É");
gotoxy(78,2);textcolor(GREEN);cprintf("» ");
gotoxy(5,23);textcolor(GREEN);cprintf("ßÈ");
gotoxy(78,23);textcolor(GREEN);cprintf("¼ß");
gotoxy(41,2);textcolor(GREEN);cprintf("Í");
gotoxy(5,6);textcolor(GREEN);cprintf("ßÌ");
gotoxy(78,6);textcolor(GREEN);cprintf("¹ß");
gotoxy(41,6);textcolor(GREEN);cprintf("Í");
for(int l=1;l<=50;l++){
gotoxy(17+l,7);textcolor(YELLOW);cprintf("ß");
gotoxy(17+l,20);textcolor(YELLOW);cprintf("Ü");
}
for(int n=1;n<=14;n++)
{
gotoxy(18,6+n);textcolor(YELLOW);cprintf("Þ");
gotoxy(67,6+n);textcolor(YELLOW);cprintf("Ý");
}
gotoxy(37,7);textcolor(9);cprintf("  M E N U  ");
gotoxy(30,9);textcolor(6);cprintf("[1] EVEN/ODD IDENTIFIER");
gotoxy(30,11);textcolor(6);cprintf("[2] 1000x NAME MULTIPLIER");
gotoxy(30,13);textcolor(6);cprintf("[3] MULTIPLICATION TABLE");
gotoxy(30,15);textcolor(6);cprintf("[4] TRIANGLE AREA CALCULATOR");
gotoxy(30,17);textcolor(6);cprintf("[5] P A Y R O L L");
gotoxy(29,19);textcolor(6);cprintf(" [6] E X I T ");
gotoxy(24,22);textcolor(4);cprintf("ENTER CHOICE:");
scanf("%d",&choice);
switch(choice)
{
case 1:int dog;
clrscr();
	printf("Enter number:");
	scanf("%d",&dog);
	if(dog%2==0)
	{
	printf("EVEN \n");
	}
	else
	{
	printf("ODD \n");
	} getche();graph();
	break;
case 2:
 clrscr();
 int e,r,t;
 char name[15];
 printf("Enter your name:");
 scanf("%s",&name);
 gotoxy (12,12);textcolor(GREEN+BLINK); cprintf("LOADING:");
 for(t=1;t<=50;t++){
 gotoxy(19+t,12);textcolor(RED);cprintf("²");
 }for (r=1;r<=50;r++){
 gotoxy(19+z,12);textcolor(BLUE);cprintf("Û");
 delay(40);
 }clrscr();
 for(e=1; e<=1000; e++){
 printf("%s \t",name);
 }
 getche();graph();
 break;
case 3:  clrscr();
	for(int a1=1;a1<=9;a1++)
	{
	for(int a2=1;a2<=9;a2++)
	{
	printf("\t");
	printf("%d",a1*a2);
	}
	printf("\n");
	}
	getche();graph();
	break;
case 4: int a,b;
clrscr();
	printf("Enter base and height:");
	scanf("%d%d",&a,&b);
	printf("Area is %d.",(a*b)/2); getche();graph();
	break;
case 5:

float rate,day,gp,netpay,totald,sss,med,love;int age;
float basic,cola,tax;char employee[20],addr[30],sex[10],bday[8];

int main(){
clrscr();

char choice;
gotoxy(20,2);textcolor(4);cprintf("Payroll System");
gotoxy(20,4);textcolor(5);cprintf("Select Choices:");
gotoxy(18,6);textcolor(7);cprintf("[1] Add Customer Info");
gotoxy(18,7);textcolor(7);cprintf("[2] Compute Payroll");
gotoxy(18,8);textcolor(7);cprintf("[3] Display Information");
gotoxy(18,9);textcolor(7);cprintf("[4] Exit");
gotoxy(18,10);textcolor(7);cprintf("Enter Choice:");
scanf("%d",&choice);
switch (choice){
case 1:printf("Employee Information\n\n");
	printf("Enter Employee name:");
	scanf("%s",&employee);
	printf("Enter address:");
	scanf("%s",&addr);
	printf("Enter sex:");
	scanf("%s",&sex);
	printf("Enter age:");
	scanf("%d",&age);
	printf("Enter bday:");
	scanf("%s",&bday);main();

case 2:printf("Payroll Input\n:");
	printf("Enter rate:");
	scanf("%f",&rate);
	printf("Enter day:");
	scanf("%f",&day);
	basic=rate*day;
	cola=basic*.02;
	gp=basic+cola;
	sss=gp*.073;
	med=gp*.081;
	love=gp*.092;

	if(gp>=2500){
		tax=gp*.12;}else
		{
		printf("No tax");}

	totald=sss+med+love+tax;
	netpay=gp-totald;main();

case 3:printf("Employee Information\n");
	printf("Employee name is %s\n",employee);
	printf("Employee address %s\n",addr);
	printf("Employee gender%c\n",sex);
    printf("Employee age %d\n",age);
	printf("Employee bday%s\n",bday);
	printf("\n");
	printf("payroll Information\n");
	printf("Rate per day%.2f\n",rate);
	printf("Number of day%.2f\n",day);
	printf("Basic%.2f\n",basic);
    printf("Cola %.2f\n",cola);
	printf("Grosspay%.2f\n",gp);

printf("Tax is%.2f\n",tax);
    printf("Total deduction %.2f\n",totald);
	printf("netpay%.2f\n",netpay);getche();main();

case 4: exit(0);
default:printf("Invalid input");getche();main();
}
getche();graph();
break;
	}
case 6: exit(0);break;
default:printf("Invalid Entry");
}
getche();}

I suspect that if you fixed that piss poor formatting, you would easily find the problem. But noooo, you had to make it harder on yourself by writing code in a manner that hides bugs.

Comments
And this is the improvement ;)

I suspect that if you fixed that piss poor formatting, you would easily find the problem. But noooo, you had to make it harder on yourself by writing code in a manner that hides bugs.

And sorry but IM ******** New to C++. And its compiler btw is Turbo C++. Its ancient. Thank you. Please stick to the topic. Im new to C++ and knows nothing.

And sorry but IM ******** New to C++. And its compiler btw is Turbo C++. Its ancient. Thank you. Please stick to the topic. Im new to C++ and knows nothing.

So you think bashing on a respectable regular is going to help you with your question? I don't think so.
Narue gave you some great advice. If you indent your code, you will probably see a mismatch in brackets or something.

And its compiler btw is Turbo C++. Its ancient. Thank you.

If you already know that TC++ is ancient, why are you still using it?

Im not bashing him. He started. Im just here asking not to be insulted.

Why I am using that compiler? Because it is our assignment and we cannot use advanced code that we did not yet tackle. Basic first that is what our teacher said . and again IM noob so sorry for the coding. (T T)

Edited 7 Years Ago by networkmancer: n/a

Im just here asking not to be insulted.

In the words of crunchie: "Eat some snickers. "

Why I am using that compiler? Because it is our assignment and we cannot use advanced code that we did not yet tackle. Basic first that is what our teacher said .

The problem is that you're learning all sorts of non-standard commands that you need to unlearn later. If your teacher makes you use Turbo, (s)he needs to be fired.
Visual Studio 2008 and Code::blocks are very good (free) alternatives for Turbo. C++ will non get 'more advanced' by using a compiler that lives up to the C++-standard. C++ is C++, that's why a standard was made.

Edited 7 Years Ago by Nick Evan: n/a

>Please stick to the topic.
I never went off topic. You have a brace mismatch, and the reason you have it is because your formatting is atrocious. Fix the formatting and you will see the problem.

Im new to C++ and knows nothing.
Clearly. But you know enough to write that mess, so you should know enough to format it like the books or tutorials you're following to learn C++. We don't format our code just to make it look pretty, we format it to make errors stand out. This is a lesson you need to learn, as early as possible, and I'm not afraid to beat it into you.

Im not bashing him. He started.
Your first mistake is thinking that I was bashing you. You're not important enough for me to bother. Just another noob who gets all insulted and defensive when I tell him that his code sucks. I haven't even gotten into the other problems with your code, and I probably won't if each issue is going to be a battle against your frail little ego.

Im just here asking not to be insulted.
Sorry dude, but bad code is bad code. If you're insulted by me pointing out your bad code, you have insecurity issues that need to be addressed.

Edited 7 Years Ago by Narue: n/a

Comments
Subtle and friendly as always! :)

In the words of crunchie: "Eat some snickers. "

The problem is that you're learning all sorts of non-standard commands that you need to unlearn later. If your teacher makes you use Turbo, (s)he needs to be fired.
Visual Studio 2008 and Code::blocks are very good (free) alternatives for Turbo. C++ will non get 'more advanced' by using a compiler that lives up to the C++-standard. C++ is C++, that's why a standard was made.

Sorry but it is our assignment, I have no choice. , . That is our assignment.

>Please stick to the topic.
I never went off topic. You have a brace mismatch, and the reason you have it is because your formatting is atrocious. Fix the formatting and you will see the problem.

Im new to C++ and knows nothing.
Clearly. But you know enough to write that mess, so you should know enough to format it like the books or tutorials you're following to learn C++. We don't format our code just to make it look pretty, we format it to make errors stand out. This is a lesson you need to learn, as early as possible, and I'm not afraid to beat it into you.

Im not bashing him. He started.
Your first mistake is thinking that I was bashing you. You're not important enough for me to bother. Just another noob who gets all insulted and defensive when I tell him that his code sucks. I haven't even gotten into the other problems with your code, and I probably won't if each issue is going to be a battle against your frail little ego.

Im just here asking not to be insulted.
Sorry dude, but bad code is bad code. If you're insulted by me pointing out your bad code, you have insecurity issues that need to be addressed.

Sorry . ok . I know its a bad code but as I said we must stick to basic codes and not advanced . I did not code them btw. I am not studying to any books or tutorials and I know beauty is not perfect if it has bugs and errors. It is just our assignment . Not a big deal actually to discuss and I dont care actually if its messy what I care is that I need to run it . I dont care because I dont like what the program will do and I am not the one who made that code actually. Only Case 1 to case 4 is my code and all other is from my classmate. I just copied and paste it then attach my code to Case 1 to case 4 and that case 5 is not mine either..

Edited 7 Years Ago by networkmancer: n/a

Comments
Failure of the day award

I dont care because I dont like what the program will do and I am not the one who made that code actually. Only Case 1 to case 4 is my code and all other is from my classmate. I just copied and paste it then attach my code to Case 1 to case 4 and that case 5 is not mine either..

Good luck with failing your class!

*plonk*

Edited 7 Years Ago by Nick Evan: n/a

I am not studying to any books or tutorials

OMG You mean to tell us you learned to drive a car with your eyes closed :icon_eek: Get yourself an Into to C Programming book and read it Or google for online tutorials and study them It won't matter to you how old the books or tutorials are because you have a crappy teacher anyway.

Trying to learn C or C++ by steal-cut-and-paste is generally a waste of time and effort if you have no clue what the code does or how it does it.

OMG You mean to tell us you learned to drive a car with your eyes closed :icon_eek: Get yourself an Into to C Programming book and read it Or google for online tutorials and study them It won't matter to you how old the books or tutorials are because you have a crappy teacher anyway.

Trying to learn C or C++ by steal-cut-and-paste is generally a waste of time and effort if you have no clue what the code does or how it does it.

Sorry because actually I am more focus in VB right now and not in C++ with our old compiler. I learn VB by tutorials and books. our teacher is not crappy actually he is just telling us the difference between the old compilers and the new ones. I have clue of what they do actually but when that code was discuss I was absent. I just want to know why it gives declaration error . That is the one you said to me to adjust in my previous thread.

I just want to know why it gives declaration error . That is the one you said to me to adjust in my previous thread.

Take Narue's advice and fix up your code. After you do that you will be able to see the problem. I don't have the time or inclination to fix your code for you. That's you job, not mine. If you want to be a coder then you have to learn to pay attention to details and not try to do shortcuts.

You might also use a code beautifier to do it for you

Edited 7 Years Ago by Ancient Dragon: n/a

This article has been dead for over six months. Start a new discussion instead.