C/C++ :: How To Get Total Number Of Items Selected From Options Menu
Jul 28, 2014
My project is to make a options menu for the user to select a shape and than draw out the shape. That whole process is already done and ready to go. What i am having trouble on is totaling the number of selected shapes. For example, at the end of the program i need to prompt a message saying ("You have selected "shape" this many times "number").
I am trying to write a menu program that will be broken down into a series of calls to function for each of the menu items. Two of the menu items will be simple programs which I wrote.
I want two of the functions to run one of the two programs I am trying to include as items in the menu.
So far I am only familiar with variables, loops, if statements, and I just learned how to write functions.
The problem I am have is that I don't quite understand how to write a function that will run one of the two programs. Also I am having a hard time writing the program in away that would allow the user to select the menu items.
I am having problems with setting up a menu as a function. The point of the menu is to display a list of 4 options and the user is supposed to choose one option and then the program will run. I am having trouble understanding how to display the menu once I run it because it is not working.
#include <iostream> using namespace std; int menu(int ans); // function declaration for menu void draw_triangle(int size, char ch); //function declaration for triangle void draw_downtri( int size, char ch); // function declaration for upside-down triangle void draw_diamond(int size, char ch); //function declaration for diamond
I decided to create a simple program to display a menu with options, while that is easy enough I had some difficulty when selecting an option that has options inside which also has an option again. While I had many issues in the past I'm finally finished with it and it works fine, but being new to programming and not knowing various other methods available.
Code: //:::::::::::::::::::::Simple Menu Program:::::::::::::::: //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
I need a program that has a login system and then a menu that has 3 options: Add, delete and exit. If I choose Add it wil ask for certain data of 5 students.
Then after registering the 5 students, another menu with the options: Search, Delete and exit. In search it will ask for an ID and then prints all the data of a single student. Delete gives me the option to delete the data of any user I choose.
I'm trying to build an app, but i don't know which is the best language choice. For starters, the app should be able to:
1. run from context menu 2. when selecting some text from a web browser (ff, ie), that text is captured (preferably not in clipboard) and sent as argument to the program via context menu and the program starts executing...
I'm using winforms and I want to set a checkbox on a dropdown menu item, but I don't know how to access the dropdown menu items.
I know ToolStripMenuItem items are attached to ContextMenuStrip items but I'm not sure how to navigate into the ToolStripMenuItem section to read/set those menu items.
ToolStripMenuItem listbox_font_size; cmsListBox = new ContextMenuStrip(); cmsListBox.Items.Clear();
I am not getting all the records.... when i select the same date in both datetimepicker no record is displayed... i also want the record of the selected dates from both datetime picker..
IF statement. Really new, so this will be simple I'm sure. I'm essentially just trying to roll a 6 and 20 sided die. I want the statement to run "If 20,then display the randomly selected number for 20".
// auto dice roller #include <iostream> #include <string> #include <ctime> #include <cstdlib> using namespace std;
I'm working in a web aplication in c#, vs 2008, framework 3.5, I need to assign a value to a var, in this case "problemas", when I tried to save the value that I have in the checkboxlist, it does, but if don't selected, can't show 0, besides if I change the value "problemas = 9" to problemas = 111111" doesn't works.
The program requires the user to enter 10 integers then print the total no. of even integer,highest even integer, lowest even integer then total no. of odd integer,highest odd integer, lowest odd integer
I already got the total no. of even integer and total no. of odd integer. But I don't know how will i get the highest even integer, lowest even integer and highest odd integer, lowest odd integer.
How can i count total number of each topic separately? For example total number of topic 1 between all nodes. To begin enter 10 and 7 to initial node number and number of topic.
Summary: 6 companies have a product in 5 different warehouses. Each company is identified by a positive ID number and each warehouse is identified by a number (1 for the first, 2 for the second,…)
Object: the object of this assignment is to write a C++ program which asks the user to enter a company ID number, and the number of products in each of the warehouses. It then computes and prints the total number of products for that company
If the total number of product is less than 100, it prints the message “place a new order”
Input: for each company, its ID, and the number of products in each warehouse with appropriate prompt messages. Example: Enter company ID number: 101 Enter number of products in warehouse #1:30 Enter number of products in warehouse #2:60 Enter number of products in warehouse #3:0 Enter number of products in warehouse #4:5 Enter number of products in warehouse #5:27 The total for company 101 is:122
Output: for each company, the total number of product, and the message “place a new order” if the total number of product is less than 100.
Method: 1. Define global variable, int total_prod to hold the total number of products for a company 2. define the function void compute_total() that uses a loop to read the number of the products in all warehouses for one company, computer the total number of products and store it into the global variable total_prod. 3. Define the function void new_order() that determines if a new order need to be placed as follows: if the total number of products (in the global variable total_prod) is less than 100, it prints the message “place a new order” 4. Your function main does the following in a loop: - read a company ID number - call function compute_total() to read the number of the product in all warehouses for that company, and to compute their sum - print the total number of the product for that company with an appropriate message - call the function new_order() to determine if a new order need to be placed.
Write a C++ program to calculate the fewest number of each denomination needed to pay a bill of amount TOTAL. For example, if the end user enters $97 for TOTAL, program will output that the bills would consist of one $50 bill, two $20 bills, one $5 bill, and two $1 bills. (Assume that the amount is in whole dollars, no cents, and only $100, $50, $20, $10, $5, and $1 denominations are available.) Aid: You may want to use the modulus operator %.
I am trying to create a word counter program that asks for the price per letter and then asks for the sentence they are writing. The app should then calculate the number of letters and give the total cost similar to:
You have 40 letters at $3.45 per letter, and your total is $138.00.
Everything compiles fine but when I run it the inputs don't work and it outputs:
You have -1 per letter, and your total cost is $-0.
I'm creating a program that is based on a menu system. Basically each menu is its own user-defined function. The problem is at each menu you can input 'b' to go to the previous menu. I just have it call the function of that menu.
However, do the functions need to complete themselves eventually? If I just keep calling functions will I just keep going further and further deeper into ever running functions?
If so how do I avoid this and yet keep the option to go back to a previous menu/function?
This is what I have so far, it gives me a nice menu to select from and it all works but after I make a selection it closes the program. I tried to return to it but it won't work for me
#include <stdio.h> int main() { int choice; int deposit; int balance = 500; { printf(" CHOOSE FROM THE FOLLOWING
I have two menu items. When item 1 is disabled, I want item 2 to be disabled as well. In the OnUpdate handler of menu item 1, I have tried to use "t_pMenu = pCmdUI->m_pMenu;", "t_pMenu = pCmdUI->m_pSubMenu;" and "t_pMenu = pCmdUI->m_pParentMenu;" but I always get NULL t_pMenu. How can I achieve this purpose?
I have called a C function inside C++ code. The .so which gets created is a 32 bit while I am looking for 64 bit . What all options should be mentioned in the Make file to eventually compile and get shared object of ELF64 CLASS ?
Excerpts from Makefile -----------------------------