C++ :: Structure Declared With 10 Components - Value Set Previously Deleted

Oct 31, 2013

I have a small questions in the behavior of Structure, I have declare a structure with 10 components. Some of the components in the structure has already their value but when I use

The structure components in a function DLL function those value I set previously has been deleted or empty. I don't know what is the problem...

View 1 Replies


ADVERTISEMENT

C++ :: Why Does GetY Have To Be Declared After Struct Y Is Declared

Jan 30, 2013

struct x
{
y *GetY(); //error: what is "y"?
struct y
{
};
};

Why does GetY have to be declared after struct y is declared? I thought order of class members in C++ did not matter? Does it have to do with the way parsing is done?

EDIT: It also doesn't work if I typename x::y *GetY();, which makes even less sense to me.

EDIT: It works if I forward declare, but this goes against everything I know about C++ classes...

View 6 Replies View Related

C# :: Compare One Value To A Previously Entered Value?

Oct 3, 2014

I am currently taking a C# class. Our current assignment has us entering a player name, and number of hits and displaying these in one set of labels. I have coded everything for the primary function of this program and it works. However, I also have to have a second set of labels that show the highest number of hits entered (if I enter 44, the first and second labels change to 44; if I then enter 27, the first label changes to 27 and the second stays at 44; and if i enter 55, the first label changes to 55 and the second label changes to 55) and the corresponding player name. I have tried searching and reading and I can't seem to figure out how this is done.

View 5 Replies View Related

C++ :: How To Reuse Memory Previously Allocated

Dec 14, 2013

I have a question about memory allocation.I have a function that calls a lot of object constructors, which in return these constructors will allocate a lot of memory.Now, in my program I am sure that if I first call this function , say it will call the constructor of 100 object.If I call this function again and again, I am sure that it will only call the constructor 100 times again, and thus I am sure that the memory allocated in the first call can be reused again.

How can I reuse the memory allocated in the first call?Can I use something like boost:object_pool so that I can tell the pool to restart from the begining and do not allocate extra memory, just use what you already have?

View 6 Replies View Related

C Sharp :: Interact With Components From Other Forms

May 6, 2013

What I'm doing is giving the user the choice to show 2 different dates. 1 in yyyy-mm-dd notation and the other in dd-mm-yyyy notation.

I'm using a second form to do this.

So from Form1 I have my data in the datagrid and in Form2 I have 2 radio buttons giving the user the choice between Date1 and Date2. So how would I be able to interact with the first form with the radio buttons?

View 10 Replies View Related

C++ :: Set Limit On What Can And Can't Be Deleted

Nov 11, 2013

Is there any way to set a "lock" on certain couts from system ("cls"). You can this with const to "lock" a variable to a certain value so I am wondering if that is true for couts from system ("cls"). This would make my program much simpler to write.

View 2 Replies View Related

C++ :: Initializing N-dimensional Array With A List Of Components

Nov 7, 2014

InitializeNArray<4, bool, NARRAY>()(narray, {1,2,3,2}, true);

is supposed to initialize a 4-dimensional std::array a with a[1][2][3][2] = true.

The commented-out line, which is the desired recursion, does not compile for some reason, and the problem third parameter cannot be deduced. So I placed some temporary lines to work in the special case only. Howw to make that recursion work?

#include <iostream>
#include <array>
#include <vector>
#include <memory>
template <typename, int...> struct NArray;

[Code] ....

Incidentally, this is a sub-problem within the task of initializing more generally with

template <typename T, int... N, typename... ARGS>
typename NArray<T, N...>::type NDimensionalArray (const T& value, ARGS&&... args)

Once this subproblem is fixed, then the bigger task is fixed too.

View 7 Replies View Related

C# :: Delete Image That Was Previously Shown In ItemsControl

Dec 22, 2014

On line 128 I'm attempting to delete an image file that was previously shown in an ItemsControl, but was removed by line 126. So the image is not being shown in the program at the time I'm wanting to delete the file.

Error:Additional information: The process cannot access the file 'c:StudioExit PopupKeith Sketch.png' because it is being used by another process.

My Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;

[code]....

View 10 Replies View Related

C Sharp :: Replace Or Delete Image That Has Been Used By Another Process Previously

Apr 6, 2012

I'm using web cam to save,update the image in base directory folder.I can save the image but, while attempting to update the image..I caught an error!!

C#.Net:
The process cannot access the file 'C:..~..inDebugcustomer_photos10.jpg' because it is being used by another process.

View 2 Replies View Related

C++ :: Attempting To Reference A Deleted Function

Feb 20, 2015

Been away from c++ for a few months now (apart from answering a few questions on this site). I was trying to see if I could do a simple program using just my memory that involved unique_ptr's, but getting an error:

"attempting to reference a deleted function". I thought that by getting a reference to my pointer would not invoke a copy constructor but i'm clearly wrong.

Here's the code:

#include <iostream>
#include <memory>
#include <vector>
class Shape {
public:
virtual void Draw() = 0;

[Code] ....

View 5 Replies View Related

C :: Finding Number Of Connected Components From Undirected Disconnected Graph

Feb 17, 2013

How to find the number of connected components from an undirected disconnected graph.

the input I'm getting is like this:

7
1 2
4 5
3 6
2 7

the top number is the number of vertices and the rest of the numbers are the edges, eg. 1--2 is an edge.

Is there a way that you can implement DFS algorithm to find the number of connected components? like increment a variable every time DFS is called or something?

View 1 Replies View Related

C++ :: Pointers To Automatically Null When Object Is Deleted

May 18, 2013

Say I have an object and 10 pointers to it in several other objects of varying class types. if the object gets deleted, those pointers have to be set to null. normally I would interconnect the object's class with the classes which have pointers to it so that it can notify them it is being deleted, and they can set their pointers to null. but this also has the burden that the classes must also notify the object when THEY are deleted since the object will need a pointer to them as well. That way the object doesn't call dereference a dangling pointer when it destructs and attempts to notify the others.

Auto pointers and shared pointers are not what I'm looking for - auto pointers delete their object when they destruct, and shared pointers do the same when no more shared pointers are pointing to it. What I'm looking for is a slick method for setting all pointers to an object to null when the object destructs.

View 1 Replies View Related

C :: Blurring PPM Image By Averaging Components Of Color Within Certain Reach Of Specific Pixel

Mar 13, 2014

I'm trying to blur a ppm image by averaging the components of the color(r, g, b) within a certain reach of a specific pixel. This is a picture and description:

In this diagram, we are trying to compute the color for the pixel in the center (the red element). Its neighbors (within a reach of 4) are all of the green elements. The pixels outside of this 9x9 square are not considered in the blurring calculation for this pixel. To compute the color for the center pixel, average the red, green, and blue components (independently) of every pixel in the 9x9 square (including the pixel itself; the red element in this diagram).

I have some code, but it is not working correctly. The function "computed_color" on line 52 is shown in the next block of code.

Code:
#include <stdlib.h>
#include <stdio.h>
#include "blur_calculations.h"
#define NOT_ENOUGH_ARGS 2
#define MIN_ARGS 3
#define PICTURE_FILE 1
#define REACH_NUMBER 4
#define OUTPUT_FILE "blurred.ppm"
#define PPM_NUMBER "P3"
#define MAX_ROWS 500
#define MAX_COLS 500

void solve(FILE *in_picture, FILE *out_picture, char *argv[]) {

[Code] ....

Here is my code to calculate the average, which I use in my "solve" function:

Code:
#include "blur_calculations.h"
struct color create_color(int r, int g, int b) {
struct color colors;
colors.r = r;
colors.g = g;
colors.b = b;
return colors;

[Code] ....

View 4 Replies View Related

C :: Make A File In Directory That Cannot Be Deleted By User Out Of Program

Jul 4, 2013

I have two questions about C programming here :

1. I want to make a file in the program directory that can't be deleted by user out of the program make that file.for example if I make a file named "123.xyz" by the program named "text.exe" and then exit test.exe ,if I tried to delete the file 123.xyz I faced the error and I could not do it but by the test.exe program that make that file.

2. I heard about a function called "Parbegin()".any way i want to know is there any possible way to run two or more functions of a file.c together,like the parbegin function did an do in OS?

View 2 Replies View Related

C++ :: Call To Implicitly - Deleted Default Constructor Of Node

Oct 26, 2014

i tried running my code and i keep getting the error "call to implicitly-deleted default constructor of 'node'. My code is as follows

//.h file
typedef struct node * point
struct node{
string data;
node *next
}

[code]....

I get the error at the line "ptr1 = new node;" I tried putting a default constructor for my node struct and that fixed the problem but a new problem arises. It states that i have a linker error after i compile it with a default constructor.

View 7 Replies View Related

C/C++ :: Not Able To Initialize Structure Variable Inside Main Whose Structure Defined GL

Aug 27, 2013

I am trying to run a programme implementing a function with structures in c... which is:

#include<stdio.h>
#include<conio.h>
struct store  {
        char name[20];
        float price;    
        int quantity;

[Code] .....

View 1 Replies View Related

C++ :: How To Use Structure Pointer Through A Structure Public Member Definition

Dec 7, 2014

Why doesn't this compile?

struct hi(){
void other();
}histructure;

void hi::other(){
std::cout << "Hi!" << std::endl;

[Code] ....

Makes no sense the structure is written before the structure member function is called so why is there compile errors ??...

View 3 Replies View Related

C/C++ :: Value Assignment To Structure Member Inside The Structure?

Oct 7, 2014

Is it possible to assign a value to structure member inside the structure.like.....

struct control{  
char tbi:2 =0;
char res:1 =0;
};

View 6 Replies View Related

C :: How To Create A Structure That Pointing To Another Different Structure

Mar 17, 2013

how I can create a structure that pointing to another different structure. And also passing structure to function.

View 3 Replies View Related

C++ :: Memory And Int Not Being Declared

Mar 19, 2013

I had a quick question regarding a program I am trying to complete. I have the basics worked out, and everything seems to be done, but I am running into two issues.

1= The program keeps telling me "Run-Time Check Failure #3 - The variable 'order' is being used without being initialized."
and
2= When I reach my output screen I receive "Unhandled exception at 0x7751c41f in CISC 192 Project 3.exe: Microsoft C++ exception: std:Out_of_range at memory location 0x002eefb8.."

While the first one isn't necessarily a deal breaker the second one definitely is.

Code:
// Bookstore Project 3.cpp : Defines the entry point for the console application.
// Declarations
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <string>
#include <istream>

[Code] ....

View 2 Replies View Related

C++ :: Swap Is Not Declared?

Jun 15, 2013

#include <iostream>
#include <conio.h>
using namespace std;

[Code]....

appears that error on line 25 & 30 where swap1 & swap2 is not declared in this scope.

View 6 Replies View Related

C++ :: Declared By Function

Aug 20, 2013

MCLoad.h - MCLoad.cpp
bool MCLoad::Load(SDL_Surface* Name, std::string File){
Name = NULL;
Name = SDL_LoadBMP(File.c_str());
if(Name == NULL){return false;}
else{return true;

[code].....

compiler gives me the error bg was not declared in this scope. i googled it.

in MCInit #include <SDL/SDL.h> #include "MCLoad.h"
in MCLoad #include <SDL/SDL.h> #include <string>
in MCClean #include <SDL/SDL.h> #include "MC.h"

View 14 Replies View Related

C/C++ :: String Not Being Declared

Aug 18, 2014

I'm setting the Arduino to send data from it's analog pins through to my PC, but to keep it easier to manage, I'm trying to turn the analog reading into a character string, so instead of sending just the value, it instead sends "Pin 1: 345" for example, where 1 is the number of the analog pin in use, and 345 is the reading from that pin.

In my code below, the problem is getting my string variable to be recognized. When I try to verify the code, the error message I get reads "'string' does not name a type" yet when I compare it to other string variable examples on the internet, I can see no difference between mine and the ones online.

I've tried having the declaration in the loop, outside of the loop, and now at the start with the other declarations.

#include <string>
using namespace std;
string outText;
void setup() {
Serial.begin(9600);

[Code] .....

View 9 Replies View Related

C++ :: Fin Undeclared Identifier But Is Declared

Apr 8, 2013

Program is not finished as I can't get passed read_data

Error:
"error C2065: 'fin' : undeclared identifier
error C2228: left of '.open' must have class/struct/union type is ''unknown-type''

#include "stdafx.h"
#include <iostream> // for streams
#include <iomanip> // for setw()
#include <fstream> // for files
#include <cstdlib> // for exit
using namespace std;
void read_data(int A[], int size)

[Code] .....

View 2 Replies View Related

C++ :: Variable Not Being Declared Before Initializing - But It Is?

Mar 31, 2014

I'm working on this program, and when i run it for 'p', 'P', or for a incorrect service code a error message pops up saying that "totalCost is being used without being initialized". I don't want to change it to switches, case, and breaks now because I've come too far to change it all. I have that variable right here just below.

#include <iomanip>
#include <iostream>
using namespace std;
int main() {
int acctCode;
double nightCost;
double totalCost;

[Code] ....

View 4 Replies View Related

C++ :: (X) Not Declared In This Scope Error

Oct 29, 2014

main.cpp

#include <iostream>
#include "sushi.h"
using namespace std;
int main()
{
do {
......sushi go;
......string x; <----------------------------Declared x here
......cout << "wanna use a banana?" << endl;

[Code ....

Error reads: 'x' was not declared in this scope.

How do I fix this?

P.S The sushi class does not matter, that is all perfect. Also, the dots are to represent my tabbing to make it easier to understand.

View 2 Replies View Related







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