- #include<stdio.h>
-
void main()
-
{
-
char choice;
-
int month,sum,num,i,a,b;
-
int age,kasarian;
-
char ans;
-
int e,c,d;
-
int num1,num2,diff,prod;
-
clrscr();
-
-
main_menu:
-
{
-
printf(" ++++++MAIN_MENU+++++\n");
-
printf(" + [1] if +\n");
-
printf(" + [2] switch +\n");
-
printf(" + [3] for loop +\n");
-
printf(" + [4] exit +\n");
-
printf(" ++++++++++++++++++++\n");
-
printf("enter your choice:");
-
scanf("%d",&choice);
-
clrscr();
-
if(choice=='1')
-
{
-
if_program:
-
printf(" *#*#*#*#*#*#*#*#*#*#*#*#*\n");
-
printf(" * [A] age *\n");
-
printf(" * [b] mdas *\n");
-
printf(" *#*#*#*#*#*#*#*#*#*#*#*#*\n");
-
printf("Enter Your choice:");
-
scanf("%s",&choice);
-
-
if((choice=='A')||(choice=='a'))
-
{
-
printf("enter your age:\n");}
-
scanf("%d",&age);
-
if(age>=0 && age<=2)
-
{printf("still a baby",age);}
-
else if(age>=3 && age<=12)
-
{ printf("children",age);}
-
else if(age>=13 && age<=17)
-
{ printf("teenager",age);}
-
else if(age>=18 && age<=26)
-
{printf("young adult",age);}
-
else if(age>=27 && age<=39)
-
{ printf("middle age",age); }
-
else if(age>=40 && age<=79)
-
{printf("grand parents",age);}
-
else
-
{printf("higher",age);}
-
-
-
printf("do u want to run another if_program?'Y'/'N'");
-
scanf("%s",&ans);
-
if((ans=='Y')||(ans=='y'))
-
-
{goto if_program;}
-
-
}
-
}
-
if(choice=='B')
-
{
-
printf(" !!!!!!!!!!!!!!!!!!!!!!!!\n");
-
printf(" !! [1] addition !!\n");
-
printf(" !! [2] subtraction !!\n");
-
printf(" !! [3] multiplication !!\n");
-
printf(" !!!!!!!!!!!!!!!!!!!!!!!!\n");
-
printf("enter your choice:");
-
scanf("%d",&choice);
-
if(choice==1)
-
{
-
printf("addition");
-
printf("enter the first number:");
-
scanf("%d",&num1);
-
printf("enter the second number:");
-
scanf("%d",&num2);
-
-
sum = num1 + num2;
-
printf("The sum of two numbers is:%d",sum);
-
}
-
else if(choice==2)
-
{
-
printf("subtraction:");
-
printf("enter the first number:");
-
scanf("%d",&num1);
-
printf("enter the second number");
-
scanf("%d",&num2);
-
-
diff= num1 - num2;
-
printf("the difference of two numbers is:%d",diff);
-
}
-
else
-
{
-
printf("multiplication");
-
printf("enter the first number");
-
scanf("%d",&num1);
-
printf("enter the second number");
-
scanf("%d",&num2);
-
-
prod=num1 * num2;
-
printf("the product of two numbers is:%d",prod);
-
}
-
-
printf("GO BACK TO MAIN MENU?'Y'/'N'");
-
scanf("i",&ans);
-
if((ans=='Y')||(ans=='y'))
-
{goto main_menu;}
-
-
}
-
}
-
if(choice=='2')
-
{
-
switch_program:
-
-
printf(" #####################\n");
-
printf(" ## [W] kasarian ##\n");
-
printf(" ## [Z] animals ##\n");
-
printf(" #####################\n");
-
printf("enter your choice");
-
scanf("%s",&choice);
-
switch(choice);
-
-
if(choice=='W')
-
-
{
-
printf("ienter ang iyong kasarian:");
-
scanf("%s",&kasarian);
-
switch(kasarian)
-
{
-
case 'a' : case 'A':
-
{
-
printf("ikaw ay BABAE");
-
break;}
-
case 'b' : case 'B':
-
{
-
printf("ikaw ay LALAKI");
-
break;}
-
case 'c': case 'C':
-
{
-
printf("sa kang BAKLA");
-
break;}
-
case 'd': case 'D':
-
{
-
printf("TOMBOY ka pre");
-
break;}
-
default:
-
-
{
-
printf("invalid:");
-
-
printf("do yOU want to run another switch program:?'Y'/'N'");
-
scanf("%s",&ans);
-
if((ans=='Y')||(ans=='y'))
-
{goto switch_program;}
-
}
-
}
-
else if(choice=='Z')
-
{
-
printf(" $$$$$$$$$$$$$$$$$$$$\n");
-
printf(" $$ [1] dog $$\n");
-
printf(" $$ [2] cat $$\n");
-
printf(" $$ [3] mouse $$\n");
-
printf(" $$$$$$$$$$$$$$$$$$$$\n");
-
scanf("%s",&choice);
-
switch(choice);
-
{
-
case 1:
-
-
{printf("the dog is the biggest");
-
break;}
-
case 2:
-
{printf("the cat is the medium");
-
break;}
-
case 3:
-
{printf("the mouse is the smallest");
-
-
printf("do you want to run another program?'Y'/'N'");
-
scanf("s",ans);
-
if((ans=='Y') || (ans=='y'))
-
{goto main_menu;}
-
}
-
}
-
}
-
}
-
if(choice=='3')
-
{ loop_program:
-
printf(" ::::::::::::::::::::\n");
-
printf(" ::: [E] sum :::\n");
-
printf(" ::: [F] :::\n");
-
printf(" ::::::::::::::::::::\n");
-
printf("enter your choice");
-
scanf("s",&choice);
-
if (choice=='E')
-
{
-
for(e=1;e<=1;e++)
-
{printf("$");
-
printf("\n");
-
for(c=1;c<=2;c++)
-
printf("$");
-
printf("\n");
-
for(d=1;d<=3;d++);
-
}
-
-
}
-
else
-
{printf("invalid choice");}
-
-
}
-
getch();
-
}
2 1277 Meetee 931
Recognized Expert Moderator Contributor
Can you please post the error message also? I think, it would be always helpful to describe a problem.
Closing brace on line 110 corresponds to open brace at line 3 - the body of main() function, so it refuses to parse 'if' operator outside the function body. It's not surprising you messed up the braces given that this code is a unstructured mess of ifs and elses.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: DouggieC |
last post by:
Hi,
I am attempting to overload the '<' operator in order to sort an array structure, but get a syntax error in Borland Builder5.
Code as follows:
struct GroupTeamType
{
AnsiString Name;...
|
by: mandogon |
last post by:
Hello peoples
i am having trouble compiling this program getting a the error is "Declaration Syntax error" using borland c++ bulider v.6 if any one can help thanks
void __fastcall...
|
by: kellymart87 |
last post by:
//remain.cpp
#include <iostream.h>
#include <conio.h>
int main()
getline ()
|
by: DanielTNBaker |
last post by:
Basically gettting a "Declaration Syntax Error" do not understand what i have done wrong would appreciate it if someone could help.
void Search_Client(void);
void PriceList(void);
void...
|
by: Lothsfeld |
last post by:
Can someone help me w/ this
I can't run it and I keep getting errors
unable to open include file 'stdio.h' and declaration syntax error
#include<stdio.h>
main();
{
int a,b,c;
...
| |
by: Bowzer1999 |
last post by:
I am a beginner at C++ and would be very grateful if someone could simply tell me why my program will not compile.
My program is as follows,
#include <stdio.h>
#define int 1ST VALUE = 23.0
...
|
by: networkmancer |
last post by:
Written in Turbo C++ so dont tell me its very messy because I know it is and this is an assignment that we must stick in to. The source of the problem is in Case 5 int main { . I just dont know how...
|
by: Blondie1966 |
last post by:
Im trying to write a program about a truck inventory with trucks coming and going and the amount in each one, but keep coming up with declaration syntax error.. Any help would be greatly appreciated....
|
by: dianaroslan |
last post by:
There are three errors in coding during compile. one of them is the declaration syntax error. can help me to finish coding this? really need help from anyone who knows. i have some problem with my...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |