getting an invalid null pointer error message after a successful build. This program is supposed to ask for firstName, lastName, age and maJor and keep doing so until the age that is input is 0 and then the program closes. Here is what I have.
#include <iostream> #include <string> using namespace std;
Build a class named "salesCompany". Save it's name with a string and an array with records which will be filled with values from sales in different cities of the company.
Build the constructor which must get as a parameter the name of the company and a text file which will fill the array. There is an example of the text file format. Every line saves the sold quantity of a product, identified by a code, in a certain city.
CodeCityQuantity 1a63bCity11200 45ab8City2550 #include <iostream> #include <string.h> using namespace std; class salesCompany {
[code].....
what should I add more and how can make it available for the user to enter as an input a text file.
I'm supposed to build a banking simulation program around the BankAcct class, which provides the following service: create new account with unique account number (maximum 5 accounts created in a single test running); deposit/withdraw; print information of all existing account. I was running a test program with only 2 services first, namely creating new account and depositing, but the program just keep on crashing and I couldn't figure out why.
#include <iostream> #include <sstream> #include <string> using namespace std;
I am currently working on a custom "Array" class for a project, and I have run into an error I don't quite understand the source of. The relevant code is as follows:
template<typename T> class Array { private: T errValCopy; public: T __errVal__; uint16 __size__; T* __ptr__; Array(const T& errorValue);
[Code] ....
When I try to run the following code:
Array<Array<int>> a(Array<int>(-1));
The error log tells me there is no appropriate default constructor available. If I understand it correctly, "default constructor" refers to the constructor which lets you just write Array<int> a; instead of Array<int> a(...);, but I can't see where in the code such a situation occurs...
I have made a custom class matrices class which allows me to add, multiply, subtract (etc.) matrices. I have the following method for multiplication but I get an error that says
'invalid use of 'this' outside of a non-static member function'
How can I refer to the current instance without getting this error.
I attempted to create a dynamic array class for use in my engine (due to problems regarding a dll-interface with the standard library), so I tried at making a standard-compatible allocator template class first. After I "finished" that, I went on to work on the dynamic array class itself.So I finish the dynamic array class, and test it with the standard allocator. It works perfectly, but when I test it with my custom allocator class, it fails terribly.
To make sure it wasn't my DynamicArray class that was causing issues, I tried using the custom allocator on the std::vector class template, and it didn't work either. IMy DynamicArray class code:
// Represents a dynamic array, similar to the standard library's "vector" class. template<typename T, typename A> class DynamicArray { public: DynamicArray() : data(nullptr), elements(0), capacity(0)
[code].....
The "Request" and "Free" functions are my engine's equivalent of malloc and free (or new and delete). I allocate a large buffer (16 mb), and through those functions I distribute the memory to where it's needed.
If I have an array of some class, and that class has const members, is there some way I can call a custom constructor on elements of the array?
I can't seem to reinitialize an element in foos in the example below. A thread on stack overflow mentioned the copy constructor show allow it, but I get "no match for call to '(Foo) (Foo&)'" when I try it.
Code: Error1error LNK2019: unresolved external symbol "public: __thiscall ReachTop<class Character>::ReachTop<class Character>(class Character *)" (??0?$ReachTop@VCharacter@@@@QAE@PAVCharacter@@@Z) referenced in function "void __cdecl `dynamic initializer for 'gReachTop''(void)" (??__EgReachTop@@YAXXZ)Main.objDecisionTest
my code is already finished. im using parallel queues and im having problem in the queue customer name if i dont input space the code is fine but if i input space in the name it skips the bagcode and immediately jump to the number of bags what can i do to include the white spaces in the customer name and push it to the queue?
here's my code
#include <iostream> #include <string> #include <queue> #include<conio.h> using namespace std; int main() { queue<string> customer;
I need to build an array in a function and return that array. Well, two arrays actually, which means I can't return it in the return statement.
Long term, this function/method is supposed to return two populated buffers for further processing. The buffers/arrays are loaded from a file. So, the size of the array is completely unknown until after the file is read. So, you can't have a fixed size array until the function is almost ready to return.
I'm hardcoding the arrays here for testing purposes, but eventually they will be loaded in from a file. That's the whole purpose of this.
Anyway, I need to pass the arrays that are created in this function/method to the caller. But I can't figure out how to do it. The code "almost" works, except that it's overwriting my array when it returns.
VertexListPointer returns the correct data structure (actually its an array of structures). The problem is that the first time I use the other variables it over rights the array. The pointer still points to the same spot, but VertexBufferDescription is next to the VertexListPointer and so completely overwrites it.
What I "think" I want is to allocate the array in a totally different area of memory. VertexListPointer should be a pointer, not a contiguous block of memory. It should point to the contiguous block of memory elsewhere.
This is where my weak understanding of pointers comes back to bite me in the posterior end.
In the end, I just want to pass back two arrays/buffers to be used by the calling code.
I'm not sure if I was some weird syntax problem or the way Ive ordered things. But a conditional statement I have created is not performing the way I want it to.
When debugging, the condition was activated with the values:
xDif = -1 yDif = 1 prevXDif = -1 prevYDif = 0
However, I want the condition not to follow through as I am using the 'NOT' or '!' operator to negative the entire statement. For some reason, the line of code within the else if is still running.
my programme showing error 'unable to open inclde file ****' i fallowed the general procedure i.e., options-->directories--> ( inclde proper path) still not working..
I've downloaded a file that I need to include in a new project. It's called phidget21.h and it's sat on my desktop. I've tried copying it to lots of various places. But I still can't get a new source file to compile. I think I haven't copied it to the right place yet. Where should I have copied it to?
i want to write a c++ program to build min heap which gets above values from user. remember this program should not alloduplicate values to enter. it should discard duplicate values.