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


ADVERTISEMENT

C++ :: Red Black Tree - SFML

May 17, 2014

How to make a red and black tree using SFML ....because i really need...I really don't know how to use SFML i only know how to use win32 console.

View 3 Replies View Related

C++ :: Detect Colors In The Black Rectangle?

Oct 5, 2013

I want to detect colors that in the black rectangle. [URL] How can I do? What library should I use?

View 7 Replies View Related

Visual C++ :: Red / Black Trees Value Deletion

Nov 26, 2013

I've been working on my deletion function for Red and Black trees but can't seem to get it to work. From what I can tell, the remove function, instead of deleting the single value that will my prompt by the user, will delete all the values that are in the red and black tree.

Code:
bool RedBlackTree::remove(int x) {
if(!search(x)){
return false;
} else {
Node* z = new Node(x);
rbremove(z);

[Code] ....

View 4 Replies View Related

C :: Creating PPM Image - Black Rectangle With A Circle

Mar 12, 2013

I'm trying to create a PPM image for a class assignment. A black rectangle with a circle at the point 225, 175 with a radius of 75. I have to use certain specific methods, so I can't use like Bresenham's really famous method for creating a circle.

The problem is that it compiles fine, and transfers to an image fine, but always says that I have a negative or zero image size.

Code:

#include "shapes.h"
int main () {
int i, j, x, y;

fprintf(stdout,"P6 width height 255
");

[Code] ....

And my header is:

Code:
#include <stdio.h>#include <math.h>
#define height 480
#define width 640
#define cy 175
#define cx 225
#define radius 75

The circle has to be filled in. I made it white. Also, i and j are unsused so far, so just ignore them.

View 1 Replies View Related

C :: Creating Black Bitmap - How To Set Color Of Individual Pixel

Nov 2, 2014

creating a bitmap. Our professor wants us to creat a black 100*100 bitmap.

Code:

#include <stdio.h>
#include <stdlib.h>
#pragma pack(push,2)
typedef struct{

[Code].....

I dont even know where to start. I spend the last 7h infront of my computer and i'm so frustrated cause my professor gave us no information what so ever. At the moment its more of a trial and error process than anything else.

How would i set the color of an individual pixel for examplel or how would i save the file ?

View 1 Replies View Related

C :: Calculate Black Body Spectra Over User-entered Range Of Wavelength And Temperatures

Jul 29, 2013

I tried to write a code to calculate black body spectra over an user-entered range of wavelength and temperatures. The equation I'm trying to code is the second one this image (stolen from Wikipedia)The syntax to run it is bbgrid lambda_inic lambda_final temp_inic temp_final inc_T inc_lambda

where bbgrid is the name of the program, lambda_inic and lambda_final are the limits of the wavelenght range (in units of angstroms, 1A=10⁻⁰m), temp_inic and temp_final are the limits of the temperature range (in Kelvins) and inc_T and inc_lambda are the increments. What I want to do is, given the ranges of temperatures and wavelengths, to run the code over the lambdas and the temperatures.

The problem is that the behaviour of the intensities (what I'm calculating) is erratic. Sometimes it is highly positive, sometimes immensely negative and turning between those two. As an example of an output file, I'm getting things like this:

3100 1915076038
3110 -1233496775
3120 1741010116
3130 1229780625
3140 421722788
3150 -1874760945
3160 1654746252
3170 1062468321
3180 -795217626
3190 -1141129750
3200 -1570716956
3210 539385985

While I was trying to debug the code, I found the problem may reside in the exponential factor in the denominator. I wrote some lines to calculate and print on the screen only the exponential, and it was oscillating like crazy. The output file should produce curves like this:

Code:

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

[code]....

View 14 Replies View Related

C/C++ :: Find Maximum Element From A Tree (not A Binary Tree)

Oct 31, 2014

I want to find maximum element from a tree (not a binary tree ) ???? ...using c language...

View 1 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++ ::  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++ :: 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++ :: 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++ :: 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 :: 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 Keeps On Crashing When It Finishes Case 1?

Oct 18, 2013

The program keeps on crashing when it finishes case 1

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

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

Visual C++ :: Crashing On Fstream Open File

Jan 20, 2013

other posts talk about the fopen function and don't really give any solutions to this the var that has the file path is a char* and has been converted from a system::string^ it is completely valid when I paste it in windows bar.

Code:
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
if(textBox1->Text[0] == (char)'' || textBox2->Text[0] == (char)''){
MessageBox::Show("Please select a valid m3u and path", "Problem",
MessageBoxButtons::OK, MessageBoxIcon::Exclamation);

[Code]....

it crashes right at the pile.open() function call when I put breakpoints in it says , debug assertion failed and shows me the fclose.c file location and Expression: (stream != NULL)

View 5 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







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