Closed Thread
Results 1 to 9 of 9

Thread: [HELP] C++ program that will ask the user to enter not greater than to 15 numbers

  1. #1
    Kyram143 is offline Newbie
    Join Date
    Aug 2008
    Posts
    4
    Rep Power
    0

    Unhappy [HELP] C++ program that will ask the user to enter not greater than to 15 numbers

    Problem:

    Write a C++ program that will ask the user to enter not greater than to 15 numbers (decimal numbers are accepted). Please observe the output format below. Trace the program from logic to syntax especially for no inputs and inputs that have zeros (0s). Take note as well that if the data to be searched in element, index, or value is not found, the program will display “No such data located!”. Hint: for menu I, you can use any of the sorting algorithms such as insertion sort, selection sort, bubble sort, and the rest.


    Output:

    -------------------------------------------------------------------------------------------------------------------------------------------

    MAIN MENU:

    [C]Input Values
    [P]Display Elements, Index, and Values
    [R]Search by Element
    [O]Search by Index
    [G]Search by Value
    [I]Sort the Values
    [T]Display the Member’s Complete Names with Course, Year, & Section
    [E]Exit

    Your choice is:
    --------------------------------------------------------------------------------------------------------------------




    SAMPLE MENU ACTIONS:

    --------------------------------------------------------------------------------------------------------------------------------------------

    If user opts to choose C:

    Enter 15 numbers: 1 2 3 4 5 6 7 8 9 10 11 12.1 13 14 1

    Return to Main Menu? Y or n for yes to exit the program, N or n for no and exit the program.
    --------------------------------------------------------------------------------------------------------------------------------------------

    If user opts to choose P:

    Element Index Value
    1 0 1
    2 1 2
    3 2 3
    4 3 4
    5 4 5
    6 5 6
    7 6 7
    8 7 8
    9 8 9
    10 9 10
    11 10 11
    12 11 12.1
    13 12 13
    14 13 14
    15 14 1

    Return to Main Menu? Y or n for yes to exit the program, N or n for no and exit the program.
    --------------------------------------------------------------------------------------------------------------------------------------------

    If user opts to choose R:

    Search by element: 2
    2 is located at index 0 with the value 1

    Return to Main Menu? Y or n for yes to exit the program, N or n for no and exit the program.
    --------------------------------------------------------------------------------------------------------------------------------------------

    If user opts to choose O:

    Search by index: 10
    10 is located at element 11 with the value 11

    Return to Main Menu? Y or n for yes to exit the program, N or n for no and exit the program.
    --------------------------------------------------------------------------------------------------------------------------------------------

    If user opts to choose G:

    Search by value: 1
    1 is located at element 1 and 15 and at index 0 and 14

    Return to Main Menu? Y or n for yes to exit the program, N or n for no and exit the program.
    --------------------------------------------------------------------------------------------------------------------------------------------
    If user opts to choose I:

    Sorted values are: 1 1 2 3 4 5 6 7 8 9 10 11 12.1 13 14
    Return to Main Menu? Y or n for yes to exit the program, N or n for no and exit the program.
    --------------------------------------------------------------------------------------------------------------------------------------------

    If user opts to choose T:

    The members are Henry William Gates and Grace Murray Hopper, BSIT 2D

    Return to Main Menu? Y or n for yes to exit the program, N or n for no and exit the program.
    --------------------------------------------------------------------------------------------------------------------------------------------

    If user opts to choose G:

    Do you want to close the program? Y or n for yes to exit the program, N or n for no, and return again to the main menu.
    --------------------------------------------------------------------------------------------------------------------------------------------


  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Kyram143 is offline Newbie
    Join Date
    Aug 2008
    Posts
    4
    Rep Power
    0

    Re: [HELP] C++ program that will ask the user to enter not greater than to 15 numbers

    HELP me please

  4. #3
    Join Date
    Jul 2006
    Posts
    16,479
    Blog Entries
    75
    Rep Power
    143

    Re: [HELP] C++ program that will ask the user to enter not greater than to 15 numbers

    We can't help you until you ask us a question. For example: do you know how to do input/output? Do you know how to process input? Something else? What have you written so far?
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  5. #4
    Kyram143 is offline Newbie
    Join Date
    Aug 2008
    Posts
    4
    Rep Power
    0

    Re: [HELP] C++ program that will ask the user to enter not greater than to 15 numbers

    im newbie to C++ sir i dont know how to program i need a code for that problem can you help me please? but im starting to learn on how to program C++. I really appreciate your help sir

  6. #5
    Kyram143 is offline Newbie
    Join Date
    Aug 2008
    Posts
    4
    Rep Power
    0

    Re: [HELP] C++ program that will ask the user to enter not greater than to 15 numbers

    HELP me please

  7. #6
    Join Date
    Jul 2006
    Posts
    16,479
    Blog Entries
    75
    Rep Power
    143

    Re: [HELP] C++ program that will ask the user to enter not greater than to 15 numbers

    Returning to basics: Are you familiar with how to get input, display out, use an if statement, and use a while loop?
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  8. #7
    wenkang is offline Newbie
    Join Date
    Aug 2008
    Posts
    4
    Rep Power
    0

    Unhappy Re: [HELP] C++ program that will ask the user to enter not greater than to 15 numbers

    Sorry.I can't help you.

  9. #8
    Join Date
    May 2008
    Posts
    2,126
    Blog Entries
    1
    Rep Power
    33

    Re: [HELP] C++ program that will ask the user to enter not greater than to 15 numbers

    Entering a topic just to tell someone you can't help them...

  10. #9
    Join Date
    Nov 2009
    Location
    I seem to be lost...
    Posts
    1,566
    Blog Entries
    1
    Rep Power
    22

    Re: [HELP] C++ program that will ask the user to enter not greater than to 15 numbers

    Dude nobody has any Idea what your wanting here.
    I just wrote up a thing that only let you enter a number under 15.
    Code:
    #include<iostream>
    
    using namespace std;
    
    int main()
    {
    double number = 0;
    char again = 'y';
    
    while(again == 'y')
    {
    cout << "Enter a number below 15.";
    cin >> number;
    
    if (number <= 15)
    {
    cout << number << endl;
    }
    else
    {
    cout << "Sorry invalid number." << endl;
    }
    
    cout << "Do you want to enter another number? (y/n) ";
    cin >> again;
    }
    cin.get();
    return 0;
    }
    You need to tell some one your question.
    Knowledge: Intermediate C#, Beginner AS3, HTML, CSS, Binary, Hex, Octal.
    Science is only an educated theory, which we cannot disprove.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Limiting the amount of number a user can enter
    By teensicle in forum C and C++
    Replies: 5
    Last Post: 04-09-2011, 12:25 PM
  2. User Input: Strings and Numbers [C]
    By dcs in forum C Tutorials
    Replies: 3
    Last Post: 05-09-2010, 03:57 PM
  3. if greater than but less than
    By opencircles in forum Python
    Replies: 15
    Last Post: 02-16-2010, 12:19 PM
  4. Replies: 4
    Last Post: 12-31-2009, 05:59 AM
  5. Simple program to add odd numbers
    By nahrain in forum Visual Basic Programming
    Replies: 4
    Last Post: 04-06-2009, 01:55 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts