473,405 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

using for loop and functions to create a basic menu

hi, I'm trying to make a function that when it is executed asks the user for three options multilplication, division and exit. If the user the user makes a wrong option, the program re-executes asking the user to enter the right option and make the selection again. Can someone please help me on where I'm going wrong.Here is my code:

Expand|Select|Wrap|Line Numbers
  1.  
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5.  
  6. int print_Menu();
  7.  
  8. int main(void)
  9. {
  10. printf("This program tests you with ten questions.\n 1) Multiplication\n 2) Division\n 3) Exit\n Please make a selection (1-3)", print_Menu);
  11.  
  12.  
  13.  
  14. return 0;
  15. }
  16.  
  17.  
  18. int print_Menu()
  19. {
  20.    int i;
  21.     int menu;
  22.    for (i=1; i<4; i++)
  23.     {
  24.         scanf("%d", &i);
  25.         if (i==1)
  26.         printf("Please give the answers to the following additions:");
  27.  
  28.         if (i==2)
  29.         printf("Please give the answers to the following division questions:");
  30.         if (i==3)
  31.         printf("Press the Enter key to exit");
  32.         else
  33.         printf("Incorrect choice entered: Please select from one to three numbers");
  34.  
  35.  
  36.     }
  37. }
  38.  
  39.  
Feb 19 '11 #1
1 3227
Rabbit
12,516 Expert Mod 8TB
You haven't written anything...
Feb 19 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Raymond H. | last post by:
Hello, 1- How to see, in a Label, the URL of a link that the mouse pass over? (in the WebBrower control in a vb projet). 2- How to create a menu and a submenu via a button Command1? and...
2
by: Nick | last post by:
Loop to create an array from a dynamic form. I'm having trouble with an application, and I'll try to explain it as clearly as possible: 1. I have a form with two fields, say Apples and...
3
by: Raghu Raman | last post by:
Hi, I am new to .net and got a good foundation in Vb and i hope i am picking up the .net framework. I could easily create a menu item in VB.NET But How to create a webpage with menu items...
2
by: gaffar | last post by:
Hello Sir, i need the funtionality of Using ADOX to create a JET Database and tables in it and one to many relationship between the tables. Thanks for your help Gaffar.
4
by: samreen | last post by:
i want to create and access directories using C functions.............could u please help me out regarding this....
1
by: /M | last post by:
Hi! As you know, one way to seperate platform dependent code from platform _independent_ code is to create an abstract base class which acts as an interface towards all platform independent code...
1
by: weird0 | last post by:
i have detected the event of treeview node mouse click. All i want is that when a user clicks, a menu appears. How can i create a menu? Not the static one, that appears on the top. The one that...
2
by: prasyeee | last post by:
my doubt is ..... You just float the mouse cursor on Discussions, forums Howtos and our community links in this page then we get one menu from that links.... i don't know how to create this so can...
0
by: chong | last post by:
Good day, i am new user in visual basic. Need to ask for help for some advice about how to create new menu in Intellicad to link up Cad and Microsoft Access using Visual. By using Visual Basic as...
3
by: hanumanthanaidu | last post by:
hi this is naidu i have a program for create a menu bar that contain simple arithmetic operations on user entered tow numbers , this program doesn't contain switch and if statements , operations...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...
0
agi2029
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.