Jump to content

[HELP NEED URGENT] How can I combine this one? (TURBO C++)

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
networkmancer

networkmancer

    Newbie

  • Members
  • Pip
  • 8 posts
I know im using the old compiler but its our assignment

I need to put this one in my case 5


     #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();}



to here


#include <stdio.h>

#include <conio.h>

#include<process.h>

#include<dos.h>

void graph();

void main(){

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:



case 6: exit(0);break;

default:printf("Invalid Entry");

}

getche();


}



I tried putting it in case 5 but it will just lead me to main. Not returning back to the choices in case 5 then

What I did is this but gives me this error

Linker Error: Undefined symbol_main in module c0.ASM


#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];


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();


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();

}


#2
networkmancer

networkmancer

    Newbie

  • Members
  • Pip
  • 8 posts
anyone??

#3
Guest_Jordan_*

Guest_Jordan_*
  • Guests
In the first one, rename void main() function to some other name. Include it in the second file and then under case 5 call that renamed function.

#4
networkmancer

networkmancer

    Newbie

  • Members
  • Pip
  • 8 posts
But I cant put

void rename(){ inside case 5 because it will give me declaration error due to

void graph(){ . How can I make the case 5 return to its own menu and not the main menu of void graph{