C/C++ :: Menu Selection Does Not Continue To Desired Screen

Mar 8, 2014

Basically we have to create a system for loan amortization for vehicle company. The code is still in its development stage and I am having problems with one of the menu selections. all the other menu selections work fine except for menu selection 3. I'm quite stuck on it. When I run the program everything goes well except when I enter 3 at the main menu, it just exits the program instead of going to the screen for the menu selection.

#include<stdio.h>
#include<conio.h>
#include<string.h>
main() {
char un, /*username*/
name, /*customer name*/

[Code] ....

View 1 Replies


ADVERTISEMENT

C/C++ :: Creating A Menu That Will Return The Menu After A Selection

Apr 7, 2014

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

[code]....

View 14 Replies View Related

C :: Selection Menu With Enter Key Support

Apr 27, 2013

I am working on a database project, which can store (initially) 10,000 marksheets with following capabilities

1) new entry
2) edit/modification of entry
3)delete entry
4) separate Departements ( BBA, BCS, M.Phil, Phd., etc.)
5) can store data on files ( initially, all data is stored in a single file)

Now, I want to create a menu, in which i can use arrow keys to navigate through the menu and use Enter key fo selection.

What should i use in it?? The project is only on C language.

View 4 Replies View Related

C :: How To Create Menu Selection With Arrow Key

Jun 22, 2014

I'm looking for an example of menu selection with arrow key i'dont know how to create one o think i should use CODE ASCI but what method I should follow

View 1 Replies View Related

C# :: Option Selection Box To Change What Appears In Main Window Screen

Sep 17, 2014

Basically i have a 'HomeWindow' with a button 'OptionWindow'. My idea is that the 'OptionWindow' button will open up the 'OptionWindow'. Which will give the user three options 'Option1', 'Option2' and 'Option3'. If they pick 'Option1' then in the 'HomeWindow' in a stackpanel i want it to display 'UserControl1'. Where as if they pick 'Option2' then in the 'HomeWindow' in a stackpanel i want it to display 'UserControl2'.

If you need some of my code that i have already then let me know what you need as i have a lot of it so can't paste it all in one go. But the new thing i need is the way of making the user-controls in the 'HomeWindow' change depending on what is selected in the 'OptionWindow'.

View 14 Replies View Related

C/C++ :: Polymorphism Is Stopping Short Of Desired Class

Mar 2, 2014

I've been working on this project which inserts data for different types of books lately, and I'm trying to utilize inheritance and polymorphism. The issue I've been having is after I create an object with my MediaFactory, I go to insert data into that type of object, but it won't reach the correct child class. The parent class in this case is MediaData. The class I'm trying to reach is Childrens, and the class that falls in between is called Book. The function I'm calling to insert the information is setData(ifstream&). This function simply places the information from a txt file into an object with the insertion operator.

Right now the program runs into the setData function of Book instead of Childrens. I need Childrens so I can enter all the required attributes (title,author,year). The call to this function is in MediaManager through the function called buildMedia, and my test is running into the case if (type == 'Y'). From there a pointer of type MediaData is created and pointed to a new object returned of type Childrens. I'm using my debugger in Xcode which does show that the correct object type (Childrens) was created.

I've tried a couple things so far. First I created another function called getData. From there I passed in *media and infile (txt input file) into that function, which then passed it right into setData with a pointer to the object and infile in the parameter. That didn't work, so I also tried going back into Childrens and removing MediaData from all my virtual functions and replacing it with Book. I got the same result when that happened; It morphed into Book class instead.

I have a portion of my UML as a reference. Childrens is a Book; Book is a MediaData. I also included all code for MediaManager, MediaHash, MediaFactory, MediaData, Book, and Childrens.

I did not include the operator overloads in the .cpp files to eliminate some redundancy.

//-----------------------------------------------------------------------------
// MediaManager.h
// Manager class for MediaData type objects
//-----------------------------------------------------------------------------

#ifndef MediaManager_H
#define MediaManager_H
#include "MediaHash.h"
#include "MediaFactory.h"
#include "MediaData.h"
using namespace std;
class MediaManager {

[Code] ....

View 3 Replies View Related

C++ :: Selection Process Using Roulette Wheel Selection?

Feb 9, 2013

I'm trying to make a selection process using roulette wheel selection. To do this I created two matrix, one random probabilities and one increasing probabilities. The idea is to choose a number according to the random probabilities. Here is the code I've written.

#include <iostream>
#include <conio.h>
#include <cstdlib>
using namespace std;
int main (){
float select [5], prob [10], mat [5];
int c, r, z;
cout.precision (2);
cout << "Random Number:" << endl;

[Code]...

The result I got is as follows:

Random Number:

0.0013 0.56 0.19 0.81 0.59

Increasing Probabilities:

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Selected Column:
0
5
6
8
9

The evaluation doesnt seem to start from c=0 again. The selected column should be 0, 5, 1, 8, 5.

View 6 Replies View Related

C++ :: Menu Program Broken Down Into Series Of Calls To Function For Each Of Menu Items

Aug 19, 2013

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.

View 2 Replies View Related

C :: Program Based On Menu System - Option To Go Back To A Previous Menu

Apr 7, 2014

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?

View 2 Replies View Related

C/C++ :: How To Use Press Any Key To Continue

Mar 28, 2015

I already tried getchar(); but it doesn't worked the program skips this command

View 2 Replies View Related

Visual C++ :: Enable / Disable Menu Item 2 In OnUpdate Handler Of Menu Item 1?

Sep 15, 2014

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?

Code:
void CDummyView::OnUpdateMenuItem1(CCmdUI* pCmdUI)
{
if(m_bShowMenuItem1) {
pCmdUI->Enable(TRUE);

[Code]....

View 14 Replies View Related

C :: How To Continue Minesweeper Game

Oct 24, 2013

I am just now in my first programming class for learning C language and I am stuck on one of my homework assignments. I am not asking you to write the code for me or anything because I want to learn by doing it myself but all I am asking for is some pointers to where I am messing up. My program is already finished for what she asked for but I am trying to do an extra credit where she wants us to have the user decide how big the gameboard is and how many mines to hide in it. Really I know that I need to use srand() and rand() but I am not sure how to use them to randomly place mines and without placing mines on top of others.

Code:

//Program 3 "Minesweeper" by Casey Samuelson
//10-17-2013
//This program will imitate the game Minesweeper.
//Agorithum

[Code]....

View 4 Replies View Related

C++ :: Continue Statement In Nested Loop

Feb 9, 2014

I was wondering how I could use a continue statement that continues in a nested loop. For example if I have

for (int i=0;i<amount;i++) {
for (int j=0;j<I[i];j++) {
for (int k=j+1;k<I[i];k++) {
if (P[i][j]+P[i][k]==C[i]) {
//What should be here?
}
}
}
}

If the condition is met then the most outer loop (in i) should continue to the next iteration.

If i simply fill in continue; in before the comment then it only continues the loop in k so that is not what I want.

View 5 Replies View Related

C++ :: Simple Calculator - Press A Key To Continue

Apr 20, 2015

My problem is , i want to make a simple calculator , in the console i want afterall the user to choose what type of operation he want pressing a key like i mentioned in the title the keys would be F1,F2,F3 , i'm not finding in the internet the code to the detection of a press key like what i want.

Code:
#include <iostream>
using namespace std;
int F1 (int x, int y) {
cout << "Enter a number: " << endl;
cin >> x;

[Code] ....

View 7 Replies View Related

C :: Y / N Option To Continue - Compiler Does Not Read It As A Loop

Jul 30, 2013

I've been having problems with my loop that asks if the user wishes to continue or not. The required input should either be 'y' or 'Y', or 'n' or 'N'. Anything else should be counted as invalid, and repeat the prompt for input. The first few times I ran my program, the compiler does not read it as a loop. The next few times just won't work properly.

Here is the prompt:
Code:
void question() {
char option;
printf("
Do you want to continue? {Y|N) ");
scanf("%c", &option);

[Code] ......

As it is, it immediately runs the else option, but otherwise runs just fine. I suspect it could be because I have not specified a size for the option variable, but I try doing that, and the prompt relegates everything to the else.

(And also, here's the rest of the code. Basically, it just assigns a value to the letters of the word (a/A = 1, b/B = 2, etc.), adds these values, and determines if a word is prime or not based on the sum.)

Code:
#include <stdio.h>
#include <string.h>
#define size 30
int main() {
char letter, word[size], lower, upper, option;
int i, value, ans = 0, a, choice = 1;

[Code] .....

View 4 Replies View Related

C++ :: How To Read / Edit CSV File And Continue From Last Login

May 5, 2014

I am working on a program that will do several mathematical calculation and will store the data into a csv file.The one below is just a prototype version of this.In my program,I will store my csv file as (current-date).csv using time.

With this in mind,I want my program to first check does (current-date).csv already exists.If not,the program runs normally and output all the data into the csv file.

However if (current-date).csv already exists,I want my program to read and edit that particular csv file,by skipping part1 in my code(name,id N etc.) and start with prompting the user for numbers straight-away.

In other words, if (current-date).csv already exists,the user should continue outputting the numbers from where the user last left before last termination instead of outputting the name,date & etc into the csv file again.

Eg: if no=22, continue inputting values from no=23 till terminating the program again and storing the values correctly into the csv file.

#include <iostream>
#include <fstream>
#include <iomanip>
#include <locale>
#include <string>
#include <sstream>
#include <time.h>

using namespace std;
// Program to read date N store it as currentdate.csv

[Code] ....

View 6 Replies View Related

C/C++ :: While Loop Application If They Continue Iterating Continuously?

Mar 17, 2015

what do I do if the while loop repeat iterating and do not stop running even if it did meet the conditions required?

View 3 Replies View Related

Visual C++ :: Does Not Contain Debug Information - Press OK To Continue

Sep 18, 2012

i changed my code from release to debug mode. when i try to debug it shows a dialog box that '... does not contain debug information press ok to continue"..

View 8 Replies View Related

C++ :: Horizontal Scrolling ASCII Image - Hit Enter To Continue Or Esc To End

Sep 3, 2013

I would like the coded ASCII image to scroll horizontally 3 times and then end with the message:

"Hit Enter to continue or Esc to end"

If Enter is pressed, the program should then continue to scroll another 3 times and then display the same message above.

If Esc is hit then the program loop should stop similar to an escape sequence.

Here is my code that partially accomplishes my objective:

Code:
// Professor.cpp : The entry point for the console application.
#include <iostream>
#include <string>
#include <windows.h>
#include <stdlib.h>

[Code] .....

View 3 Replies View Related

C++ :: Promote User To Enter Y / N In Switch Statement To Continue Or Not

Nov 25, 2013

I need to promote user to enter y/n in switch statement to continue or not for an other conversion after showing results of each conversion.

#include <iostream>
using namespace std;
int main() {
char a;
double n, r1, r2;
cout<<"Please Chose the Temperature Unit to Convert: "<<endl<<endl;

[Code]....

View 1 Replies View Related

C++ :: Program That Accept Positive Integer - Use Do While To Allow User To Continue Or Not

Aug 10, 2014

So this is the activity (LOOPING) :

Write a program that accepts a positive integer. The program should be the same from the given output. Use do while to allow the user to continue or not.

OUTPUT must be:

n = 5
0
1==0
2==1==0
3==2==1==0
4==3==2==1==0
5==4==3==2==1==0

if n = 6
0
1==0
2==1==0
3==2==1==0
4==3==2==1==0
5==4==3==2==1==0
6==5==4==3==2==1==0

View 2 Replies View Related

C++ :: Tell A Program To Continue Executing Next Line Of Code Within Nested IF Statement?

Nov 25, 2013

Is there a way to tell the program to continue reading the next line of code within a nested IF statement?

The reason I want to do this is because the two "else" statements in the following sample (the main and the nested else) will contain the same exact code and I don't want to repeat it twice. I know I can do this by creating a function and calling it from each else statement but I was just wondering if what I'm asking is even possible without using a function.

if(1 < 2) {
// yes 1 is less than 2
if(5 > 10) {
// do something
} else {
// no, 5 in not greater than 10
// here is where I want to tell the program to continue reading the next else statement

[Code] ....

View 8 Replies View Related

C :: Selection Sorting A 2D Array

Feb 13, 2013

Selection sorting a 2D array . Let's say i have an array like

1 2 3 4 //4 elements
1 2 // 2 elements
1 2 3 4 5 //5 elements
1 2 3 //3 elements
1 //1 element

And I want to do a selection sort it in descending order which the row with 5 elements will come first then 4 then 3 and so on. So that it would look like this

1 2 3 4 5
1 2 3 4
1 2 3
1 2
1

Code:
void selectionSortDescending(int list[MAX_ROW], int size){
int temp;
int walk;
int curr;
int large; // index of the largest element

for (walk = 0; walk < size - 1; walk++)

[Code] ....

View 7 Replies View Related

C# :: Invert ListBox Selection?

Apr 18, 2014

I have my ListBox working and I'm able to select the items I want to keep. I'm trying to now get the Invert of the current selection for the items to delete.

I tried using:

if (lstLinePatterns == null) return;
for (int i = 0; i < lstLinePatterns.Items.Count; i++)
lstLinePatterns.Items[i].Selected = !lstLinePatterns.Items[i].Selected;

But
.Selected
is giving me an object error.

Is there an easy way to just inverse current selection?

Current Code:

private void btnSelectNonRvt_Click(object sender, EventArgs e)
{
// Unselects any Items to Prevent Infinite Loop
lstLinePatterns.SelectedIndex = -1;

[Code]....

View 3 Replies View Related

C :: Implementing Selection Sort Algorithm

Jun 14, 2014

So i'm trying to implement the selection sort algorithm and it seems that the code is fine but...

Code:
#include <cs50.h>
#include "helpers.h"
void
sort(int values[], int n) {
// TODO: implement an O(n^2) sort

[Code] ....

I keep getting these errors and i don't understand why:

/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status

View 3 Replies View Related

C++ :: How To Check User Selection (yes / No) On Message Box

Feb 10, 2013

How can you tell what button(yes/no) on a message box is clicked? Below is what I have right now but I am getting errors.

if (MessageBox(NULL,"The Message", "The Title", MB_YESNO) == IDYES){
do something
}

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved