C++ :: Program Compiles / Runs But Closes Right Away When Finished

Oct 15, 2013

Program compiles and runs no problem but closes right away when finished.

Heres the code:
Code: #include <iostream>
#include <cmath>
using namespace std;
double calcDistance(double,double, double, double);
float calcKilometers(float, const float) ;

[Code] ....

View 3 Replies


ADVERTISEMENT

C++ :: How To Open Finished Program Directly

Mar 5, 2014

I don't know how to put this really, but I finished a program in Qt, and i want to know how to make a .exe file for it, so i dont have to open Qt and build the program every time i use it.

View 2 Replies View Related

C++ :: Program Compiles But Doesn't Run

Apr 28, 2013

My program compiles but doesn't run, Here is the screen shot of debugging

//DynBag.cpp : Implementation File
#include <stdexcept>
#include <iostream>
#include "DynBag.h"

[Code] .....

View 3 Replies View Related

C :: Program Compiles Fine But Seg Faults While Running

Dec 1, 2013

So i compile fine, but when i run my program, after the printf it just segfaults (core dumped)...

Code:
#include<stdio.h>#include<string.h>
#include<stdlib.h>
void main() {
unsigned int j=0, max=9;
char num[100] , str1[100], str2[max];
FILE *fp;

[Code] .....

View 4 Replies View Related

C :: Program That Runs On A PC But Not On Another

Mar 6, 2015

I'va create a c program that scans the web from a root it works on mypc but dont works on another pc of my friend.I have created this project with Visual Studio 2013 disabling extension to obtain standard ansi c project.

View 2 Replies View Related

C++ :: Program Compiles But Refuses To Print Out Char Grades?

Nov 10, 2014

#include <fstream>
#include <ostream>
#include <iostream>
#include <iomanip>

using namespace std;

const int NAMESIZE = 15;
const int MAXRECORDS = 50;

[Code] ....

View 2 Replies View Related

C++ :: Program Compiles Successfully But Calculations Give Wrong Answer

Feb 11, 2013

I'm using MSVC++ and it builds sucessfully but somewhere something is obviously messed it. Once i try to debug it just shows weird numbers.

int k=0; //could this be the problem??? since 0 would be over writing any given value. but if i leave int k; it showsa warning and MSVC would count that as an error

#include "stdafx.h" //Header file section
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
//structure declaration
struct menuitemtype

[Code] ......

View 14 Replies View Related

C/C++ :: Infinite For Loop - Program Just Closes

Feb 10, 2015

So I learned how to make a basic for loop and I decided to try my best to make an infinite one. Every time I run it, it doesn't say anything and just closes. Visual Studio doesn't say there's anything wrong with my code.

Here's the code

#include <iostream>
#include <conio.h>
using namespace std;
int main () {
int d = 9;
for(int k = 10; k < d; k = k +1) {
cout << "For loop value = " << k << endl;
getch();
} }

View 4 Replies View Related

C/C++ :: Program Closes When Using Any Number In Switch

Feb 17, 2015

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

[Code]....

when running the program it closses after the switch.

View 2 Replies View Related

C/C++ :: Program Runs Into Error After Input Display

May 16, 2014

The code is supposed to display the total and averages of the data as well, but cuts off due to an error in the code. The code should also:

1)Print checks for all employees, one per page, sorted by lastname. The first check number, 100, is to be read from a company data file (see requirement 4). The border of each check is important and should not be omitted.

2)Convert the net pay to a text string for each check printed.

3)Print a reference code on each check. The reference code is obtained by combining the first letter of the lastname with all the consonants remaining after removing all vowels (a,e,i,o,u).

4)Use the same employee data found in assignment 2. Use company data, obtained from a text file, for each check printed:

Spoiler

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

typedef short BOOLEAN;
typedef char STR15[15 + 1];
typedef char STR10[10 + 1];
typedef struct PayRecord

[Code] .....

View 14 Replies View Related

C/C++ :: Create Welcome Text Header During Program Runs?

Apr 20, 2014

I want to create a welcome text header during the program runs. I wanna keep it at the top while the program is running (like asking for input@ showing output).

EG:
-----
WELCOME
----- //Stay until end of the program
// output/input. "WELCOME" stay at the top

View 2 Replies View Related

Visual C++ :: Program Runs ONLY If Debugger Is Attached

Mar 13, 2014

I have an interesting (and incredibly frustrating) problem where my application runs fine, but ONLY when a debugger is attached to it.

I can build in both Debug or Release and double clicking the execuable causes it to crash before the window is drawn. However if I launch from the IDE (VS2010), again in both Debug or Release mode, the application runs perfectly fine.

How to debug in this situation.

I am using VS2010 in Windows 7, C++ with MFC. This is an application which has been migrated from VC++ 6 to VS2010. Note, it works perfectly when built from VC++ 6.

View 8 Replies View Related

C++ :: Calculate Number Of Days Between Dates - Program Continuously Runs

Mar 24, 2014

I have an assignment to write a program that will calculate the number of days between two dates (including leap years). We have to read the data from a file and in my current input file I have:

1 1 2000 1 5 2004
5 2 2005 2 5 2009
1 15 1998 1 15 2001

for testing purposes. When I run the program the console runs continuously spouting out "The days between your two dates are 1097." Which would be the correct output for the last set of dates entered, but I need to find out where I've messed up in my main.

#include <iostream>
#include <fstream>
using namespace std;
bool isLeap(int x) {
if (x % 400 == 0) {

[Code] .....

View 7 Replies View Related

C++ :: Program To Determine Number Of Inputted Riders And Closes When Input Is -1?

Jan 16, 2015

I seem to be having a logical error but can not find the sources.

#include <iostream>
using namespace std;
int main() {
int student = 0;
int adult = 0;

[Code] ....

View 1 Replies View Related

C Sharp :: Lock Thread Till Execution Is Finished?

Jun 26, 2012

I have a event called dataTree_AfterSelect in which I have some code which I want to execute as atomic operation like this:

protected void dataTree_AfterSelect(event params)
{
code that should not be disturbed
}  

What is happening now is, I am able to select another node of tree & in that case another execution of above function starts causing a garbled result.

What I want is, user should be able to click on tree node but execution of code block should only start after first execution is totally over.

View 4 Replies View Related

C++ :: Code Compiles Successfully Yet Previous Day Is Blank

Feb 17, 2013

//#include "stdafx.h"
#include<iostream>
#include<cmath>

using namespace std;
//class declaration
class dayType{
public: int presday;

[Code] ....

So everything works perfectly, well not everything lol. Code compiles successfully without any errors but previous day does not calculate. In a sense that when it asks for number of previous days it returns a blank statement.

For example: Previous number day is: shows nothing

View 2 Replies View Related

C/C++ :: How To Check If EXE File Runs

May 19, 2014

found out that I had to split my project in two programs (console projects).

I wanna make sure in the main program that the logger runs and if I can, have the main program do commands within the console.

Now how can I do this? is it a header that I have to include? is it a built in feature of c++?

View 7 Replies View Related

C++ :: IDE Closes When Alt F9 Or Ctrl F5?

Sep 11, 2014

I've recently downloaded c++ ide for windows 8(dos boxed version).

Every time i try to compile or run any program. It simply closes down?

View 2 Replies View Related

C++ :: CMD Closes After User Input

Jun 7, 2014

I'm trying to make a simple program that accepts user input, simple stuff. When the user (me) enters a number to be sent to the console and i press enter so it accepts the data, it closes the command prompt and thus ending the program. I just need to find a key that i can use to continue but doesn't close cmd.

View 5 Replies View Related

C# :: Closing MDI Children Closes Main App?

Mar 14, 2014

The following not only closes the MDI children, but also the form I set to be an MDI container.

private void close()
{
Form[] childArray = this.MdiChildren;
foreach (Form childForm in childArray)
{
childForm.Hide();
}
}

View 5 Replies View Related

C/C++ :: SDL Window Auto-Closes When Image Changes

Jan 22, 2014

Background: I'm making a small game using CodeBlocks and SDL. All of the code resides in a class named Game - the only thing running in Main is the creation of the Game object and the class function execute(). So far, I've made a Start Menu with three clickable buttons. I'm in the midst of making one of the buttons - Load Game - change the game screen to the Load Game menu. Basically, when the user clicks the button, the image on screen changes according to the button they click.

Issue: After successfully making the Load Game button change the image on the screen, I found that the SDL window mysteriously closes out several seconds after the image change. What is causing this - the window stays on perfectly fine until the background image is changed and the only way to break the loop is for the player to click the x on the window. I've gone over the code several times and haven't found anything that might be the cause.

Code:

Game.h file
#ifndef GAME_H
#define GAME_H
#include "SDL/SDL.h"
#include "SDL/SDL_ttf.h"
#include <iostream>
#include <cstdlib>

[Code] ....

Output:
- Window with an Start Menu image and a button with the words "Load Game".
- If user clicks the X on the window, the window closes.
- If user clicks "Load Game" button, Start Menu image changes to Load Game image. After about seven seconds, the window automatically closes out. This isn't supposed to happen.

View 5 Replies View Related

C/C++ :: Loop Runs Twice When Reading Chars To Array From File

Nov 26, 2014

I am trying to write a function to save the state of a tic tac toe game. It seems to be working well except the loop to read the chars in from a .txt file is running 18 times instead of 9 and thus overwriting the array with blank boxes. The code below is the part of the function I am having an issue with. Counter is being increased every time the second for loop runs which should be 9 times. However, it is apparently running 18 times with the first 9 runs filling newBoard correctly and the second 9 times overwriting it with boxes. how to fix it?

ifstream inputFile("file.txt");
char newBoard[3][3];
char a;
int counter = 0;
while(counter<=9) {
for(int r = 0; r<3; r++)

[code]...

View 2 Replies View Related

C++ :: Execute Function If User Closes Console

Feb 17, 2013

I would like to implements something in my code that clears the value of my variables when the user closes the console. How to do that or the program clears the values automatically?

View 3 Replies View Related

C++ :: Calculate Wages For Employees - Loop Closes Before Finishing

Dec 11, 2013

I'm writing a code that's suppose to do a payroll for my intro cs class. At first it was working fine until I had to add the part that made sure a user couldn't enter a wage value below $6.00 and now it stops the loop right after that part for some reason.

#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int const HR = 7;

[Code] ....

View 2 Replies View Related

C Sharp :: Loop In A Button / Runs Endless When Pressing The Button And Not Only Once

Jun 10, 2014

I have an code that makes form window + button bet bigger when pressed each time, but it runs endless till out of screen,

code:
{
int S1 = 300;
int S2 = 0;

[Code]...

make it so it runs only each time i press the button?

View 2 Replies View Related

C++ :: Program With Do-while Loop To Restart Program And Validation

May 11, 2013

I am having problems at the end of the program with the do-while loop to restart the program and the validation.

#include <iostream>
#include <string>
#include <iomanip>
#include <cstdlib>
#include <time.h>
using namespace std;

[code]....

View 3 Replies View Related







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