I have one problem with my code it's working until end of this program and program show this error: Run-Time check failure #2 - Stack around the variable 'Obsd" was corrupted.
here is a code, :
#include <iostream> #include <conio.h> using namespace std; struct SData { int SDSamples; float SDSampleCount;
I'm making a guessing game program and i've encountered this error of stack around variable ' ' was corrupted. I tried to replace the variable into others but still the same. So is there anyway to solve it?I only know how to use stdio.h so preferably solution using it. Here is my program:
#include <stdio.h> #include <iostream> void main() { char choice; int num[4][4]={2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,2}; int i,k,row,col,x,y; int Array[4][4];
[Code] ....
The words in bold is the error part of the program...
I need to create a stack with the container being an unsigned int. I tried to put in numbers up to four bits each and have the program read the numbers individually. This is the code I am using:
void push(int n)//item n is pushed onto the stack, throw exception on full stack { string str="Error"; if (isFull()) throw str;
[Code] ....
When I have tested it, the program is reading the numbers as one whole number. For example, I put in the number 2, and it displays the number 2. Then I put in 2 again, but this time it displays the number 10, instead of 2 2.
I am writing a console application that creates a shuffled deck of cards using pointers and arrays, but I get the error "Run-Time Check Failure #2 - Stack around the variable 'deck' was corrupted" What's the stack? What does this mean and what did I do to cause the stack to be corrupt?
I have a problem with this work. It is that when the server send some data to the client it send them correctly but when they arrive to the client all the info are changed and i don't know why, because i print them before the send and they are right, but after they arrive to the client the data doesn't be the same.
here it is the server and client's code. In the code there are some italian words, but there are only constant, so there is a real problem to understand the code.
I am having trouble compiling my interface. I am trying to store a reference variable as a member variable of the interface object. Compiler says that the variable has not be initiated correctly.
LCD inherits from VisualInterface which is expecting a DisplayDriver object to be passed in (DisplayDriver is another interface, but thats not important).
I pass the displayDriver object in when LCD is instantiated in maininterfaces.zip
I was pasing it before as a pointer but was told that this could cause me problems with memory leaks and a reference was better, but now I cant seem to get it to compile.
I have to write a loop assigning a variable x to all positions of a string variable and I'm stuck. I don't have extensive experience with arrays and I'm also a bit confused about C-String. The problem is below.
"Given the following declaration and initialization of the string variable, write a loop to assign 'X' to all positions of this string variable, keeping the length the same.
char our_string[15] = "Hi there!";
(Please note this is a 'C-string', not C++ standard string.)"
I am curious as to what is happening to my pointers and everything once I call malloc to create space for 5 integers to try to make a stack.
Code:
#include <stdio.h> #include <stdlib.h> void add(int * TOP, int * stack); int main() { int *stack = NULL; int *TOP = NULL; stack = (int *)malloc (5 * sizeof(int));
[Code] ....
I am guessing that when I initialize stack to malloc, stack now stores the starting address of where the space is taken out, and also assigns TOP that address too. I get the choice from the user (b) to get the instruction to try to push on the stack. I was told that the if statement in the function checks if the stack has passed the bounds of 5 elements. If not, it assigns the scanned variable and puts it into what TOP is pointing to and increments TOP to the next address. It is not working and am wanting to see where my logic is wrong.
write an algorithm using stack to determine if an input of string is in the form xCy where y is the reverse of x.x and y are strings of A and B. eg : AABACABAA
I had the entire validation working until my professor said that my Pop function had to be a "void" not a "Char". Which destroyed my previous validation and now how to validate this.
I will only be posting the validating function.
All the characters are being thrown in a Stack. So I am using Pop/Top/Push/isEmpty/isFull. That will be shown in my validating code.
Correct Validations: 1. {}()[] 2. [()] 3. {([])}
Incorrect Validations: 1.[) 2.[(]] 3.{])
My main issue is that it validates "[)" correct.
I am pretty positive I must have over complicated my validation.
I am trying to implement a stack class which has struct data type as its private member. I am getiing the following error ,
bash-3.2$ g++ stack_str_arr.cpp stack_str_arr.cpp: In member function ‘void stack::push(int)’: stack_str_arr.cpp:39: error: ‘top’ was not declared in this scope stack_str_arr.cpp: At global scope: stack_str_arr.cpp:43: error: no ‘void stack::display()’ member function declared in class ‘stack’
Code:
#include<iostream> using namespace std; #define MAX 5 class stack { public : stack();
In c89/90 is there a way to retrieve a pointer from stack or whatever that would behave as this would once cast to the correct type? This is more of a curiosity than a requirement.
I am unable to make any logical algorithm to access middle of stack. I am using stack implemented with linkedlists, I have following functions available for stack like push,pop,top.
I'm following a course with coursera (algorithm 1) and my program for the assignment crashes inexorably (many are experimenting the same thing there, the assignment asks for a recursive program for solving a big graph of 500000 nodes). I'm using a version of g++ from MinGW with the editor Geany and windows7. The current setup is: