C++ :: Test Navigating With Arrows In Menu Driven Program
Aug 6, 2014
This is a program used to test navigating with arrows in a menu driven program
Whenever I run it it works but when I select any option it just producing a 'sound' but it doesn't print (cout) anything on the screen....
This program is just to test the arrow navigation and doesn't really modify,delete or add a new record but only prints stuff on screen.
#include<fstream.h> //for reading and writing files
#include<conio.h> //for clrscr()
#include<string.h> //for string characters
#include<stdio.h> //for gets and puts function
[Code] ....
View 7 Replies
ADVERTISEMENT
Apr 2, 2015
I'm working on what I thought was a pretty simple program. I'm writing a menu driven program that will allow users to obtain specified measurements of several geometric figures. I was trying to test each each time I add a function.
I keep getting this error. error C3861: 'AreaOfSquare': identifier not found.
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
#include <cmath>
using namespace std;
int menu() {
int choice;
[Code] ....
View 4 Replies
View Related
Mar 18, 2015
//complxCalc.cpp//
#include "complx.h"
using namespace std;
ifstream infile ("in.dat");
int main() {
int i = 0;
complx tempComplx;
double d = 4.5;
[Code] ....
//in.dat//
(4,4) (6,7) (2.5, 9.3) (3,8.4) (13, 26.5) (2.2, 3.4)
My plan is to make this a menu driven program, I have already got the program to give the answers but now I want it to give the user choices as well. The first step in this project is to add a menu to the program. The first menu the user sees should ask the user if the program will be taking input from a file or from the user directly via the keyboard. Regardless of option chosen, the user should then be prompted to specify whether a multiplication,subtraction or addition operation should be performed.
If the user originally chose the file input method then the program should proceed to display to the screen the results of those operations on each pair of data elements in the file and terminate. If the user chose to input via the keyboard then the user should be prompted to input the two numbers, perform the operation on those two numbers and display the results to the screen and ask the user which mathematical operation they would like to do next and continue in this manner until the user chooses to exit the program via a menu option. Fortunately the only file that needs to be edited are in.dat and complxcalc.cpp files.
View 1 Replies
View Related
May 12, 2013
The premise of this assignment is to create a menu driven, array of functions calculator. This is the code I have thus far (I haven't finished all of my comments yet, I've been to focused on clearing errors).
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
/*prototypes*/
void sum (int a, int b);
void dif (int a, int b);
void pro (int a, int b);
void quo (int a, int b);
void printMenu();
[Code] .....
I am using Visual Studio as a compiler, and I have the following errors:
error C2144: syntax error : 'int' should be preceded by ')'
error C2660: 'sum' : function does not take 0 arguments
error C2059: syntax error : ')'
error C2144: syntax error : 'int' should be preceded by ')'
[Code] .....
I can only assume that I am making simple mistakes.
View 4 Replies
View Related
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
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
Apr 24, 2014
I have got the scroll bar working if i click and drag the block but if I press the arrows nothing happens.
private void hScrollBar_Genre_ValueChanged(object sender, EventArgs e)
{
if (hScrollBar_Genre.Value == 0)
{
[Code]....
View 1 Replies
View Related
Nov 22, 2012
I have to write tic-tac-toe game in Visual 2010. My only problem is that I don't know how I can move the cursor with arrows in the console in order to fill in chosen positions in 3x3 table:
Code:
_ _ _
_ _ _
_ _ _
I guess that the needed functions are in here: [URL] ....
but I don't know from what to start with...
View 1 Replies
View Related
Apr 30, 2013
I am currently learning C and im in the middle of completing my assignment. It has to calculate parking whilst account for a few values here is the assignment sheet for specifics. Design Specifications Write, compile and test a C program with appropriate use..It's practically error less yet when i compile it doesn't come up with what i need.
Code:
/* Pre-Processor Directive */
#include <stdio.h>
#include <stdbool.h>
#define DISCOUNT_TIME_THREE 3
#define DISCOUNT_TIME_TEN 10
#define DISCOUNT_RATE_TWO 0.2
#define DISCOUNT_RATE_FOUR 0.4
[Code]....
View 2 Replies
View Related
Sep 15, 2014
How to test a program by using files containing tests and with a go file i think.
View 1 Replies
View Related
Jul 2, 2014
I wrote a program to grade T or F test. It is running, but not outputting the information.
Code:
#include<iostream>
#include<string>
#include<fstream>
#include<iomanip>
using namespace std;
double grading(char*answer, char* stuResponse, double graded);
[Code] ...
text doc:
TFFTFFTTTTFFTFTFTFTT
ABC5403 TFTFTFTT TFTFTFFTTFT
ABC5404 TFTFFTTFFTFFFTTTFTFT
View 5 Replies
View Related
Sep 23, 2014
I am working on a program that calculates the average of a list of test scores entered, with the list ended with a negative score (which is not calculated), as long as a user enters a name.
#include<iostream>
#include<string>
using namespace std;
int main() {
string name;
double score = 0.0; //user input score
[code]....
I have gotten the while loop to function. The problem lies in the calculation in the average of the test scores, such as when I enter the scores 87 76 90 -1 , which is supposed to give an average of 84.3 but my result when outputted is 86. what the problem is and what I can do to fix this error?
View 1 Replies
View Related
Mar 10, 2014
The below program is supposed to display the contents of all files listed in the command line. When I try to run the program I get the fatal error "Debug Assertion Failed" Expression: file != NULL. I've done some researching on the matter and I gather it might be because I don't have any files listed in the command line?
How to enter files in the command line! I opened the Command Window in Windows XP and tried typing in "C> argc" and "% argc" (argc being the name of the file containing the below program) without any luck.
Code:
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char * argv[]) {
int ch; // int to hold EOF
int count;
FILE *fp;
for(count = 1; count <= argc; count++) // agrc loop
[Code]...
View 5 Replies
View Related
Feb 11, 2013
Write a program that prompts for and reads in test scores. You may assume that valid test scores will be integer values between 0 and 100. You may also assume that the user will not enter more than 35 test scores. Use a preprocessor directive to define this value. User input will be complete when the user enters a -1 for the test score. When all of the test scores have been entered, the program will print out the scores. Use a while or do-while loop to read in the values. Use a for loop to print out the values.
Sample output:
Enter test score 1: 88
Enter test score 2: 67
Enter test score 3: 74
Enter test score 4: 94
Enter test score 5: 79
Enter test score 6: 56
Enter test score 7: -1
Number of scores entered: 6
Test scores entered : 88 67 74 94 79 56
View 14 Replies
View Related
Apr 7, 2013
I have created a program that allows for a user-defined number of test scores as input. After the user enters these scores, the program calculates the average test score. Here is my code:
#include <iostream>
#include <iomanip>
using namespace std;
// Function prototypes
double getAverage(double*, int);
[Code] .....
I am having trouble with the final part of my program. How do I pass the array of test scores to a function that calculates how many people got an A (90+) on the test? The final output should look like this:
The average of those scores is:
The number of A grades is:
View 2 Replies
View Related
May 22, 2013
I have created a shared object in Ubuntu (libMYLIB.so). I am now trying to compile a simple test program (testmylib.c) to see if the shared object is properly built. I am getting an error that the build cannot find the shared object. My build command is:
gcc -lm -l /dir/mylib -lMYLIB.so -o testmylib testmylib.c
where /dir/mylib is where my source and libMYLIB.so reside.
What am I doing wrong?
View 9 Replies
View Related
Oct 29, 2014
So, I was trying to code a menu for a personal movie database. But I'm having some problems.So, this is what I did,
Code:
#include<stdio.h>
int main();
{
do
{printf("Menu
[Code]...
But this is not working.Furthermore I would also like add a sub menu.
View 7 Replies
View Related
Apr 27, 2013
I hate vague errors where I don't even know where to start looking for an error. Error happens immediately and it says "Unhandled exception at 0x5981c9c7 (msvcr100d.dll) in experiment.exe: 0xC0000005: Access violation reading location 0xabababab."
#include <iostream>
#include <string>
#include <conio.h>
[Code].....
View 2 Replies
View Related
Mar 13, 2014
I just started learning the basics of programming. While encountering one of the practice problems in the book by Alex Allain I got a little confused. The question is as follows:
Write a menu program that lets the user select from a list of options, and if the input is not one of the options, reprint the list.
The author assumes you can answer this question only using if statements and/or loops (while, for and do).
This is the code I've written thus far:
Code: #include <iostream>
using namespace std;
int main()
{
int option;
char reset;
[Code] ....
For some reason, the nested while loop keeps repeating even when you input a valid option (1, 2 or 3). I can't seem to figure out why this happens.
View 4 Replies
View Related
Feb 29, 2012
To add my program into the context menu (when the user right click on excel file). I used the following code:
Code:
public static bool AddContextMenuItem(string Extension, string MenuName, string MenuDescription, string MenuCommand)
{
bool ret = false;
RegistryKey rkey = Registry.ClassesRoot.OpenSubKey(Extension);
if (rkey != null)
{
string extstring = rkey.GetValue("").ToString();
[Code] .....
I used the following function to retrieve the excel file path has been rightclick choose to load the program:
Code:
public static void OpenExcelFileWithEasyForm(string filePath)
{
try
{
string excelFilePath = Path.Combine(Path.GetDirectoryName(filePath), string.Format("{0} (EasyForm){1}", Path.GetFileNameWithoutExtension(filePath), Path.GetExtension(filePath)));
[Code] .....
But I still do not load the excel file into my program by selecting the program from ContextMenu (right click on excel file and choose program). Although if select the path to excel file from the program, the data from excel file is loaded into the program.
I'm still missing something at function OpenExcelFileWithEasyForm(). How to complete this function to load the excel file into my program when selecting programs in ContextMenu.
View 1 Replies
View Related
Oct 16, 2013
Can not seem to get the program to perform the calculations within the cases. Also, how do you set up the a prime function program within the menu. Have been trying for five days now.
#include <iostream>
#include <cmath>
#include <cstdlib>
using namespace std;
void showChoices();
double prime(double, double);
double abs(double, double);
double pow(double, double);
[Code]...
View 1 Replies
View Related
Oct 26, 2013
I need to implement a two-way asynchronous communication between two objects, not using any IPC.
What I have now is a producer-consumer model where producer sends a number "88" to consumer at random intervals. Now, I need consumer to send a number "99" back to producer at a random intervals, this probably should be done in a separate thread.
I am using GNU on Linux, here is the compile line.
Code:
g++ -g -std=c++11 main.cpp -o main
Code:
#include<iostream>
#include<chrono>
#include<thread>
class IObject {
public:
virtual void fromApp(int i) = 0;
virtual int toApp(int& i) = 0;// ???
[code].....
View 8 Replies
View Related
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
Mar 23, 2014
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::::::::::::::::
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#include <iostream>
#include <string>
//function prototypes
[Code] .....
View 1 Replies
View Related
Sep 21, 2014
I just started learning C and trying to create a program in C that will have a starting menu for a calculator. The problem is that I could do that with a switch/case but the assignment requires me to use if/else.
Here's what I have so far:
Code:
#include <stdio.h>
int calc();
int menu();
int main() {
printf("Hello. Welcome to the program.
");
printf("Press RETURN key to continue...
[Code]...
How should I go from now using if/else to have those 4 choices?
View 5 Replies
View Related
Feb 13, 2015
I tried to write a menu program as a switch-case structure with a separate function for a switch-case structure itself. The outcome for it currently is an undesired one
Code:
#include <iostream>
using namespace std;
int menu(int answer);
int main()
[Code].....
The output I get is one where it's just an infinite loop of "Bad choice! Please try again later.".
View 7 Replies
View Related