C :: Program Keeps On Crashing When It Finishes Case 1?

Oct 18, 2013

The program keeps on crashing when it finishes case 1

View 5 Replies


ADVERTISEMENT

C++ ::  program Is Crashing When Trying To Call

Sep 5, 2013

My program is crashing when I'm trying to call b = a. What has me confused is that when I call c = d = b, it all works fine.

I actually think I see it now that I posted this. In operator= I'm changing the size, but I'm not changing the size of the array that it's pointing to correct? I'm keeping it as 'p = new T[size]' rather than changing it to 'p = new T[x.size]' correct?

#include <iostream>
#include "Array.h
int main() {
std::cout << "creating Array< int > object a ...

[code]....

View 13 Replies View Related

C++ :: Program Crashing When Initialized

Oct 13, 2014

I just finished coding a program that is based on polymorphism and inheritance but when I ran the program it crashed? I do not know what is the cause of the program crashing.

#include<iostream>
#include<string>
using namespace std;
class Shape{
float density;

[code].....

View 9 Replies View Related

C :: Program Crashing When Deleting A Record

May 5, 2013

Code:

#include<stdio.h>
//bookData structure
struct bookData {
int recordNum;
char description[ 15 ];
int booksBought;
double bookCost;

[code]...

I am able to add records and show records, no problem. But when I go to delete a record, it crashes immediately after inputting the record number I want to delete. I don't see why. I've set it up exactly like the example in my book, having of course changed the variable names for my program. Does it have something to do with the pointer?

View 3 Replies View Related

C :: Program Seems To Be Crashing At Random Numbers

Mar 3, 2014

When I go to run the Fibonacci function ( fib ), it begins to return incorrect calculations towards the higher numbers, but then seems to correct itself for a little bit, but then does it again and ultimately crashes. And the program seems to be crashing at random numbers. Sometimes the it will make it up to F(55), other times it will only get to F(20).

Also, when I go to run the program on a Linux server, it segfaults, but it doesn't when I just run it on my IDE. the function adds two arrays with individual digits together. It does this to allow the program to add numbers that would exceed the boundaries of INT_MAX.

Here is the header file "Fibonacci.h":

Code:

#ifndef __FIBONACCI_H
#define __FIBONACCI_H
typedef struct HugeInteger
{
// a dynamically allocated array to hold the digits of a huge integer
int *digits;
// the number of digits in the huge integer (approx. equal to array length)
int length;
} HugeInteger;
}

[code]....

View 12 Replies View Related

C++ :: Program Crashing On Exit While Multithreading

May 11, 2014

I was writing a program and it started crashing on exit (segment fault), after the 'return 0' in main(). I figure it's an std destructor.

I started with the program I was writing and just stripped out as much as I could, while making sure the crash persisted. If I remove any of the remaining code the crash disappears, even the seemly unrelated or scoped code.

#include <iostream>
#include <fstream>
#include <condition_variable>
#include <mutex>
#include <thread>

/* Call stack results:

[Code] ....

View 2 Replies View Related

C :: Program With Fscanf Keeps Crashing - Using Eclipse Kepler

Oct 13, 2013

So this program I have to make keeps spitting out an error report when I try and run it. I am using eclipse C kepler.

The file it is supposed to read has the following text;

R1 N001 N003 20
R2 N002 N001 5
R3 N001 0 10
R4 N002 N003 10
R5 N003 N000 5
I1 0 N002 10

View 2 Replies View Related

C/C++ :: Program Crashing On A Function Call In Main?

May 5, 2014

i have this program I am working on and it seems to crash after the function call getdata()

here is the code

#include<iostream>
#include<string>
#include<cstdlib>

[Code].....

View 1 Replies View Related

C++ :: Program Crashing When Reading Text From Files

Feb 5, 2014

I'm writing a code obfuscator in C. Debugger shows no errors in the code, but the program crashes after compiling -- I'm guessing it has something to do with while loops or reading data from files.

Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
// list off all replaced elements
typedef struct ReplaceList {
char *from;// from string
char *to;// to string (random)

[Code] ....

View 3 Replies View Related

C++ :: Creating Frog Leap Game That Starts At 1 And Finishes At 12

Feb 13, 2015

I have been given the task of creating a frog leap game that starts at 1 and finishes at 12. The layout is as follows. The '@' symbols are just included to show blank white space.

1-----2 @@ 3---4
|@@ |@@@ |
|@@ |@@@ |
5@@ 6------7-----8
|@@ @@@ |@@ |
|@@ @@@ |@@ |
9----10 @ 11 @12

Each number within the game will represent an object, the user will have to reach the 12th leaf start from leaf 1. the frog can only move in the directions of forwards backwards, left and right. Any starting points? E.g. using and array or list? i have a feeling this is going to be a big task. is inheritance possible?

View 1 Replies View Related

C :: How To Get Upper Case And Lower Case Equal

Feb 18, 2015

I just dont know how to get my upper case and lower case equal...heres the program: Write a program to calculate utility cost for ACME UTILITY COMPANY. The company has 3 types of customers (R) residential, (C) Commercial and (G) government. Customers are billed based on the number of kilowatts used and they type of customer they are (R,C,or G).

Residential cusstomers are charged 0.25 cents per kilowatt hour for the first 500kw used, and 0.35 cent per kwh for all kw used over 500.Commercial customers are charged 0.22 cents per kilowatt hour for the first 999kw used, 0.29 cents per kwh for all kw used over 999 kw up to 1999 and 0.45 cents per kwh for all kilowatts used greater than 1999. Commercial customers that use over 2000 kw are charged a special surcharge of 100.0 in addition to the regular charges.

Government customers are charged 0.34 cents for the first 1500 kwh used(<=1500). 0.30 cent for the next 1000 kwh(1501-2500) and 0.25 cents for all kwh used over (>=2501)

in addition residential customer are charged .5% tax on the cost utilities while Commercial customers are 5% tax on the cost of utilities not including the special surcharge Government customers are not charged a tax

Code:

#include <stdio.h>
#include <math.h>
int main(void)
{
int R;
int ct;
int kwh;
int taxes;
int surcharge;
int charge
}

[code].....

the program should quit with Q and calculate the amount owed, utility charge, and surcharge

View 8 Replies View Related

C++ :: Menu Program As Switch-Case Structure

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

C++ :: String Comparison - Case Insensitive Program

Feb 20, 2014

So I have started this program for class but am stuck on what to do next. Basically you need to create a function to compare 2 strings (case-insensitive). The strings shouldn't be altered and the return value should be similar to strcmp.

This is my main file

#include <iostream>
//#include <cstring>
#include <iomanip>
#include "rpstrings.h"
using namespace std;
int main () {
char Str1[20], Str2[20];
short result;

[Code] .....

I don't know if I labeled the files correct. what I need to do is to add 2 defaulted arguments which will allow the user to request that you skip spaces and/or skip punctuation when doing the comparison.

Also, how I can sort the numbers when they aren't justified with leading 0's and if they aren't in the lead string (kinda of like the natural sort).

View 2 Replies View Related

C++ :: Switch Case - Program That Calculates Students Grade

Apr 18, 2013

Trying to write a program that calculates a students grade based on how many assignments have been graded. I am using a switch case since there is a total of 5 assignments, however when I enter case 1, and enter in how many I got out of 100, it just closes the program it doesn't go to the next part.

#include <iostream>
using namespace std;
char calculategrade(int total);
int main() {
// local variable declaration:
char input;

[Code]....

View 6 Replies View Related

Visual C++ :: Program To Reverse Sentence - Case Sensitive

May 31, 2014

I have to write a program to reverse a sentence like

cat
tac

but my program is case sensitive. Like if i enter sentence it gives me ecntenes(which is wrong). How to make it non case-sensitive using vectors? (I cannot use #algorithims)

// BackWardsSentence.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
string BackWords (string sentence);
int BackSentence (string sentence);

[Code] .....

View 2 Replies View Related

C++ :: How Is A Program Written To Ignore Case Sensitivity When Dealing With Input

Nov 9, 2014

I've written a simple program, which asks the user to respond to a YES or NO question using the character Y/y for YES and the character N/n for NO. The foundation of this program is based around several IF statements implemented to aid in finding the ASCII value of the character entered before invoking the corresponding cout statement that informs the user which character they entered. My Question: How should a program be written to deal with ignoring case sensitivity in regards to the users' input?

Here is my amateurish attempt,

Code:
#include <iostream>
using namespace std;
int main()

[Code] .....

The following are IF statements written for the program to determine whether the user answered YES or NO. The program then performs the cout statement that contains the corresponding character to the ASCII value found.

*/
if(user_input == 121 || user_input == 89)
{
if(user_input == 121)
{
cout << "

[code]......

View 2 Replies View Related

Visual C++ :: Reverse Sentence - How To Make Program Non Case-sensitive Using Vectors

May 25, 2014

I had been tasked to create a program that reverses a word i.e.

cat
tac

How to make my program non case-sensitive using vectors?

Code:
// BackWardsSentence.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
string BackWords (string sentence);
int BackSentence (string sentence);
string BackWords1 (string sentence);

[Code] .....

View 2 Replies View Related

C :: Compiler Keeps Freezing / Crashing

Feb 11, 2014

I wrote this code as an assignment

Code:
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
main(){

int story, age=0;
int ranColor, ranCar, ranItem;

[Code] ....

And my compiler keeps freezing/crashing. using Dec C++

View 4 Replies View Related

C++ :: Console Applications Keep Crashing

Jan 11, 2013

Any time I run my program after I make a selection from the menu the output is printed on the console screen then immediately a windows screen comes up saying project.exe has stopped working.

Below is my code, and I suspect the error has something to either

A) due with how I'm calling the method or
B) how I have the method coded.

Main
#include <iostream>
#include <fstream>
#include <string>
#include "telephone.h"
#include "tbook.h"

[Code] .....

View 4 Replies View Related

C/C++ :: Red Black Tree - App Keeps Crashing

Dec 8, 2014

Red Black Trees. [URL] .....

My app keeps crashing after about the 49th insert.

I tried debugging and it keeps pointing to this area in the Fixup:

if (z->parent == z->parent->parent->left) {
y = z->parent->parent->right;

View 13 Replies View Related

C++ :: Tail Stiva Crashing To Print?

Nov 17, 2014

i am trying to break a string and store it to a stiva (tail) i need my program to take one function like this

(a+10)* ((b+c)/(d-5)) + (9*2)

and return if it is editorial correct for example for the apper function has to return true but for this function

((a+10)*((b+c)/(d-5)) + (9*2)

has to return false.it crashes in the last part of my list i will put a comment

Code: #include<iostream>
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#include<string>
using namespace std;
struct node{
char info;
node *back;
};

[code]....

View 2 Replies View Related

C++ :: Copy Constructor With Array Crashing

Oct 7, 2014

I know everything works except my copy constructor! There are no errors. The program crashes when it goes to access the copy constructor. why the copy constructor isn't working?

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <cstring> // access to C str functions
#include "String.h" // access String class
using namespace std;
String::String( int size )// default constructor

[code].....

View 2 Replies View Related

C++ :: Console App Crashing After Calling Function

Jul 18, 2014

Im new to debugging but it says the problem is on line 97 which is the verb menu function being called in the first switch statement case 0:

verb menu is one of the sub menus i want ,and it loads but then it crashes ...

#include <iostream>
#include <string>
#include "spanishverbs.h"
#include <windows.h>
#include <cmath>
#include <cstdlib>
using namespace std;
void nounmenu();

[Code] ....

View 3 Replies View Related

C :: Insertion Sort Function Crashing If 8 Or More Values?

Jan 15, 2015

This program I'm working on accepts an array size from the user, prompts the user to store that many integers, sorts them from smallest to largest, and then searches for duplicates with a simple for loop. The ultimate goal of the assignment was to display duplicates in an array, and the rest of the functions are just how I decided to reach that goal.

Anyway, my program crashes if I choose an array size larger than 7. It sorts and displays duplicates perfectly with 7 or fewer arguments.

The exact moment it crashes is after I enter the final value it prompts me for, so it appears my inputsize() function and my inputarray() function are working, and the error may be in the arrsort() function. Code is below:

Code:
#include <stdio.h>
int funcinputsize(int);
void funcinputarray(int [], int size);
void funcarrsort(int [], int size);
void funcdupe(int [], int size);

[Code] ...

View 4 Replies View Related

C :: Passing Array To Function And For Loop Crashing

Sep 23, 2014

The first problem i'm having is in the following code.

Code: #include<stdio.h>
#include<stdlib.h>
#include<time.h>
// program ask for max value and always returns random numbers < max

[Code].....

The ultimate goal of these two programs is to merge them and make one program that takes a max value from the user and fills up an array of (10^6) elements with values ranging from (0 to maxValue).

View 7 Replies View Related

C++ :: Loading File Crashing Multiplayer Game?

Sep 4, 2014

I've been making a multilayer game for a while and have a config that the game loads for the IP and stuff. I just recently put all the loading stuff into a function just so its easier to go through the code, but now the game isn't really working. It works fine on my computer connecting to the server myself, but when someone else tries to do it it seems like the game is working like it says the IP and everything from the config. When it tries to connect it either doesn't work or crashes just saying the program stopped working. Here is the code... I don't know if this is what is causing it to not work or something else.

string LoadConfig(int &loadPort, bool &fullscreen) {
string file;
string loadIP;
vector<string> fileLines;
fstream config("config.txt");
if (config.good()) {

[Code] ....

View 3 Replies View Related







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