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


ADVERTISEMENT

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++ :: 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++ :: Basic Calculator - User Will Have To Press Enter After Every Number

Mar 22, 2013

I'm stuck because I can make the calculator just find but the user will have to press enter after every number, what is s solution to this?

#include <iostream>
#include <string>
using namespace std;
int a = 1, b, c;
string symbol;
int multiplyFunction();

[Code] .....

View 6 Replies View Related

C++ :: Simple Calculator - Result Will Always Equal Zero

Jan 21, 2014

I'm making a simple calculator and have done it all right where you can input everything, all the functions are there, but when i run the program it will come to displaying the result and it will always equal zero, I just need it to say 8+8 = 16 rather than 8+8 = 0, i don't know whether its just displaying the results as 0, or not displaying it at all, the code will follow below:

Code:

#include<iostream>
using namespace std;
double num3;
double num2;
double result;
char operation;

[Code] ....

View 4 Replies View Related

C/C++ :: Simple Polynomial Derivative Calculator

Feb 27, 2014

So I'm trying to make a derivative calculator that can do simple polynomial calculations in a very specific way. If you read the cout line you'll understand rather quickly.

#include<iostream>
#include<cstdlib>
#include<string>
#include<cstring>
using namespace std;
struct variable {
char Variable,degree,constant;

[Code] ....

I get an error at line 33 and 37 saying error: request for member '_cstr' in 'constant', which is of non-class type 'char'
and the same line with 'degree' instead of constant.

View 2 Replies View Related

C :: Creating Simple Calculator By Splitting The Program In 3 Files

Feb 21, 2014

I am new to C programming, I have been given an assignment to create a simple calculator by splitting the program in 3 files. It should have 2 .c files and 1 .h... I went through the internet extensively and could only come up with this.

main.c:

Code:

//Calculator main.c
#include <stdio.h>
#include <conio.h>
#include "Functions.h"
int main() {
float x = 0, y = 0;
int operation;

[Code]...

Functions.c

Code:

#include "Functions.h"
extern float x, y;
float addition (float a, float b) {
return a + b;

[Code]...

Functions.h

Code:

#ifndef FUNCTIONS_H_INCLUDED
#define FUNCTIONS_H_INCLUDED
float Sum(float a, float b);
float difference (float a, float b);
float remainder (float a, float b);
float product (float a, float b);
#endif

When I do a 'cl main.c' on the Developer Command window for VS2013, i get an error that reads :

main.obj
main.obj : error LNK2019: unresolved external symbol _difference referenced in function _main
main.obj : error LNK2019: unresolved external symbol _product referenced in function _main
main.obj : error LNK2019: unresolved external symbol _addition referenced in function _main
main.exe : fatal error LNK1120: 3 unresolved externals

View 5 Replies View Related

C/C++ :: Simple Calculator - Clear Screen Following User Input

Dec 10, 2014

I am working on a simple calculator in C++ .... All works fine with the calculator up until the requirement for the user to input "do you want to go again y/n" .... What i want to happen is the screen to clear down and reloop to the enter name part....but i can't get it to do that

Program Description: To write and develop a programme where a user can input a cost or price of something before VAT our program must then process the input number and must output the price with the original value plus VAT

#include <iostream>// I must use this to start my programming
#include <string> // I have added this for the extension task so the user has to input their name
#include <iomanip> // this is to manipulate the text
#include <stdlib.h>
using namespace std; // using the "using namespace std" shows that i will be using standard text throughout this programme

[Code] .....

View 5 Replies View Related

C :: Simple Multi-Session Calculator / Switch Case And While Loop

Jun 30, 2013

I have a problem with my simple operations calculator code (using C, in Code::Blocks). I am required to use a while loop statement so the user can execute multiple step operations without re-opening the program. When I launch the program, I get through the first session fine, but when I'm on the second session, when entering the two operands and press enter (to calculate), it just gives me the return and say press any key to continue (exit).Here is the code:

Code:

# include <stdio.h>
int main()
{
int num1, num2;
char op;
int finished = 0;
}

[code]....

View 8 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 :: 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++ :: 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 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

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++ :: When Press The Up Key It Will Not Display Anything

Mar 26, 2014

#include <iostream>
#include <windows.h>
#include <conio.h>
#include <ctype.h>

[Code]....

When I press the up key it will not display anything.

View 2 Replies View Related

C++ :: SDL Key Press Delay

Jan 3, 2014

When you press a key it automatically delays a bit then starts repeating without delay.

The second key pressed action comes with a delay and i want it to start repeating without delay. And could not find anything useful.

I might not be able to tell what i want exactly. Ok press simply a key and don't release it in a text editor. You will realize a delay at second character showing up.

View 7 Replies View Related

C++ :: Stopping Codes With A Key Press

Feb 25, 2013

I have a program that I made, which does a list of stuff, then checks if a key is pressed, and if it's pressed, stop the looping.

The problem is, it checks if the key is pressed once a loop, which means that if the list has delays, you have to hold the button down for a while (depending on the list).

Here's an example:
Move mouse;
Pause program for 2 seconds;
Move mouse;
Pause program for 2 seconds;
Check if key is pressed;

What ways can I fix this problem?

View 1 Replies View Related

C/C++ :: Program Skips To Press Any Key

Jun 8, 2014

I am altering this program to include some alterations for a class. When I run it with start without debugging, it just skips to press any key to continue. It will not display the cout << "Volume of box1 = " <<boxVolume1.

#include "stdafx.h"
#include <iostream>
using std::cout;
using std::endl;
class CBox {
public:
double m_Length;
double m_Width;

[Code] .....

View 1 Replies View Related

C# :: How To Jump From One TextBox To Next When Press Enter Key

Apr 13, 2014

How can i jump from textBox to next texBox when i press enterKey in c# , what i the event for that .....

View 2 Replies View Related

C# :: How To Add Keyboard And Button Press To A Program

Apr 13, 2014

I have a problem where I need to add the ability to input numbers into a calculator program through either a form button press or keyboard press. I have the button press working fine though I can't seem to get the program to start with the cursor active in the textbox for keyboard input. I've use this.ActiveControl = result; "result" being the textbox. Though the issue here is the program starts off with the cursor active but only for the first instance of keyboard inputs.

Perhaps its the way I wrote the program but is there a way I can achieve this? I found a way to write this calc by having a single event for all button presses, opposed from an event for 1-9. Not sure if this is a good approach but here is some of the code.

private double num = 0;
private string calculate;
bool pressed = false;
private void button_Click(object sender, EventArgs e) {
if ((result.Text == "0")||(pressed == true)) {

[Code] ....

View 1 Replies View Related

C++ :: Detect Arrow Key Press For Linux Only

May 13, 2012

I'm trying to implement this on ubuntu, to compile and run only under ubuntu.

I found 100s of other attempts at answering the general question of arrow key press in c++. Nothing solid.

Some recommend using the Readline for the functionality I am trying to implement, but I need to stay clear of GNU licences if I can for this project. And some tips only work on projects for windows machines... for example the conio library.

For linux there may be the option of using the ncurses library which I will take a look at, but I am stubborn and want to implement this myself. It should be an easy straight forward thing to do, which is why I am a bit frustrated at the moment.

Here is my test code so far.

#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
using namespace std;
int main(void) {
char a;
stringstream ss;
string s;

[Code] ....

So! This works... 80% of the problem is solved. If you compile this, g++ under linux, ubuntu in my case, and run. Each keystroke reveals the correct key numbers.

q=113
w=119

when I click on the up key I get,

up = 279165

I thought, I can use this number is a if(int == '279165') to detect the up key.

I was not so lucky... this int is not behaving like an int!

So I modified the code to see it I could carry out an int operation on this number.

I added a 100000 to int i.

cout<< i + 100000;

Code:
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
using namespace std;
int main(void) {
char a;
stringstream ss;
string s;

[Code] .....

Compiling and running this, and pressing the UP key gives the following number.

100027100091100065

Some some sort of array, something like, [27][91][65].

I tried all ways to access these individual numbers, actually the third one for comparison purposes, but no luck.

For completeness sake I list the other arrows.

UP = [27][91][65]
DOWN = [27][91][66]
LEFT = [27][91][68]
RIGHT = [27][91][67]

A little further digging shows that these numbers are derived from the representation of a "multi-char" constant, the data type given when pressing special characters...

Now here is the main problem I have, I can find ANY decent documentation on how to handle and play with "multi-char" .

View 4 Replies View Related







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