Click here to Skip to main content
15,903,362 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C++
#include"stdio.h"
#include"conio.h"
#include"dos.h"

main()
{
 clrscr ();
 gotoxy(30,2);
 printf("DOMINGO KIM NICOLE V.");
 gotoxy(30,1);
 printf("ACT 1C1");
 getch();
 return 0;
}

{
menu:

clrscr ();

int num;
gotoxy(30,9);
printf(" WELCOME");
gotoxy(30,8);
printf("choose what you want to perform");
gotxy(30,7);
printf("[1] looping");
gotoxy(30,6);
printf("[2] sequential")
gotxy(30,5);
printf("[3] conditional");
gotoxy(30,4);
printf("enter your choice:");
scanf("%d",&num);
if (num==1)
{
 goto loop;
}
 else if (num==2)
{
goto seq;
}
 else if (num==3)
}
 goto con;
}
else
{
 printf("invalid input");
 getch ();
 goto menu;
}
Posted
Updated 8-Jan-16 20:43pm
v3
Comments
Richard MacCutchan 6-Jan-16 10:44am    
I suggest you get a book on C++. What you have here is some very poorly written C.
Richard MacCutchan 9-Jan-16 5:11am    
It is still wrong; you cannot have a block of code outside of any function. Also, you should not be using goto everywhere, it just leads to trouble. You should do what I suggested previously and get a good book on C++ and study it.

all function code in C++ must be in a function. So your problems start with:
C++
{
menu:

it must all be in you main or another function (which needs to be called in main) like:
C++
void do_menu()
{
 menu:
//your stuff
}//closing of do_menu()

But the correct implementation is your problem.
 
Share this answer
 
You have defined a label called menu but it's outside of the function main.

If the idea is to include all the code inside the main function consider something like

C++
main()
{
  clrscr ();
  gotoxy(30,2);
  printf("DOMINGO KIM NICOLE V.");
  gotoxy(30,1);
  printf("ACT 1C1");
  getch();

menu:
 
  clrscr ();
  int num;
  gotoxy(30,9);
...


For example have a look at http://www.cprogrammingexpert.com/C/Tutorial/control_statements/goto_statement.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900