| networkmancer |
8Sep2009 05:10 |
Re: Declaration Syntax Error on line 155?[ HELP URGENT]
How can I close it ? because case 5 must return to its menu but i cannot put int main(){ inside it because when I will use int main outside case 5 it will just lead to the main menu and not the menu in case 5. I really need it badly. :embarasse
Code:
#include <stdio.h>
#include <conio.h>
#include<process.h>
#include<dos.h>
void graph();
void foo(){
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:codes...
case 2:codes.
case 3:codes......
case 4:coes....
case 5:
int main(){
float rate,day,gp,netpay,totald,sss,med,love;int age;
float basic,cola,tax;char employee[20],addr[30],sex[10],bday[8];
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;
}
getche();
here is the separate code for Case 5:
Code:
#include<stdio.h>
#include<conio.h>
#include<process.h>
float rate,day,gp,netpay,totald,sss,med,love;int age;
float basic,cola,tax;char employee[20],addr[30],sex[10],bday[8];
void 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();break;
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();break;
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();
break;
case 4: exit(0);break;
default:printf("Invalid input");getche();main();
}
getche();}
|