Thread: Help! Math program emergency!

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    3

    Help! Math program emergency!

    Hey guys could you help out with a C++ question i just got?
    it goes like this

    Write a program to display the following menu:-

    Menu
    *********
    P) Power
    F) Factorial
    E) Exit

    Request the user to enter a choice. Perform the relevant operation based on the choice entered.

    Choice P:Request the user to enter the base and exponent. Calculate the power of the numbers on the base and exponent entered.

    Choice F: Request the user to enter a number. Then calculate the factorial of the number entered.

    Choice E: User can only exit the program only by entering E or e.

    Other choices: Display "Wrong entry"

  2. #2

  3. #3
    Registered User
    Join Date
    Nov 2011
    Posts
    3
    Note the question above is part of a bigger program im supposed to do. it is merely for to finish my project before the due date which is tomorrow at 10am...

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Well show people what you have done so far. Where are the problems with your code? How much of an effort have you made?

  5. #5
    Registered User
    Join Date
    Nov 2011
    Posts
    1
    I think just do the normal way like first print the statement MENU using "cout<<".......take a character variable like 'a'.
    and again display the options like """ cout<<****MENU****<<"\n"<<"P - POWER"<<"\n"<<"F- FACTORIAL"<<"\n<<"E-EXIT";
    and again cout<<"Enter the choice";
    assign the choice to the character declared ... ""cin>>a;""
    now take a switch case switch('a')
    and take the options like case P...reditect to a userdefined function power and similarly to factorial. and E for exit ...and keep the default as ""INVALID CHOICE"".

  6. #6
    Registered User
    Join Date
    Nov 2011
    Posts
    3
    thx for bits spsk15 i've finished it. now i can finally sleep after 2 days of work

  7. #7
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    spsk15, don't have out solutions.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. little emergency help with linked list program
    By DLH112 in forum C Programming
    Replies: 2
    Last Post: 12-02-2009, 06:57 PM
  2. Please help me with this !! Emergency
    By newuser21 in forum C Programming
    Replies: 1
    Last Post: 03-12-2006, 07:22 AM
  3. Math Equation Program (I can't find the problem with my program!)
    By masked_blueberr in forum C Programming
    Replies: 14
    Last Post: 07-06-2005, 11:53 AM
  4. How to give an "emergency exit" to my program?
    By nic2128 in forum C Programming
    Replies: 7
    Last Post: 08-23-2002, 03:52 PM