210 Topics
|
|
Hello everyone! So I am still coding this game and every time I make progress somewhere I take a step back somewhere else. I know that it is late but I am re-writing from scratch. Anyway, the basic concept of how I am doing this now is as follows: I … |
|
--Homework-- Write a C program that codes a string which is given by keyboard so that the coded string includes characters with their number of sequential occurrences. For example, if the string to be coded is AAABBFFFRRRRZTT then the coded string must be A3B2F3R4Z1T2. You can assume that there is … |
|
write a programme that creates a two dimentional array initialised with test data. use 4 rows and 5 columndatatype. the programme should have the following functions: 1.getTotal:- this function should accept a two dimentional array as its argument and return the total of all the values in the array 2. … |
|
Hi, I have been trying for hours to solve this problem. I have attached below a very simplified version of my actual code. The constraints are: 1) the function "lib" cannot have its signature changed, as it is part of a library. 2) the pointer attribute "funcPtr" cannot be static … |
|
|
I have some data in the memory which is pointed to by a pointer (ptr2data), how do i pass this data to a function which accepts unsigned long/DWORD data types? [code] unsigned long* ptr2data; DWORD temp; ptr2data = (unsigned long*)&SomeArrayOfData[4]; temp = (DWORD) tempSerNum; AddDevice(7, temp); [/code] The above code … |
I've look in the C++ standard and, when listing list of compound stuff, it does not mention anything like "pointer to [B]data [/B]member of an instantiated class". So the question is: [CODE]struct test{ int a; double d; ..... //more complicated stuff here to make it a NON-pod structure) .... }; … |
|
Hello this is my first thread on the forum i tried to search everywhere for a solution but no result...:'( Im trying to figure out some easy pointer use but still get some stupid error... My fault. error C2440: '=' : cannot convert from 'char (*)[100]' to 'char' [CODE] void … |
|
Hi, I've been trying to catch up on my class and pointer code (both are weak areas for me at the moment). I tried researching as much of the code as possible and getting some in-class help, **Edit Changed program, no longer gives build error**. This is designed to take … |
|
Hello! Im having a problem with the following code structure. The code compiles without problems but when i start the program i get an "exception: __non_rtti_object at memory location...". In the constructor of the model-class i still can get the object information of the node-class through the base pointer. Once … |
|
Hi folks, this might come off as a silly question but here it is. If I have this code: [CODE]class CtrTest { public: CtrTest() { cout << "Ctr" << endl; } CtrTest(const CtrTest&) { cout << "Cp Ctr" << endl; } }; class Wrap { CtrTest test; public: const CtrTest& … |
|
just starting to learn C++, and sort of confusing about the following section of code: [CODE]int *getCharCountArray(char *str) { int *count = (int *)calloc(sizeof(int), NO_OF_CHARS); int i; for (i = 0; *(str+i); i++) count[*(str+i)]++; return count; }[/CODE] In specific, do not quite understand how the following two work? [CODE] for … |
|
Dear all, I have to use a funny structure in my code which has a 2D array and allocate it later in the program. I do it but I get error which is written below. I have urgently to finish this part of the code. Would be agreat help if … |
|
Hi guys, I'm having trouble using a pointer to a vector<float>, it doesn't seems to be responding as I'm expecting it to. Probably a silly mistake on my behalf, but would anyone kindly point it out please. [code] vector<float>* t_matrix; ... cout << "get_t_matrices 0: " << Character::anim.get_animations()[j].get_t_matrices()[0].size() << endl; … |
|
I have been learning c++ and Allegro (graphics libary) for about a year, and have been trying to get this code to work (in particular, passing the array of classes), and when compiling i get the following errors C:\Documents and Settings\User\Desktop\npc.h In member function `void cNPC::NPCmove(cNPC*)': 96 C:\Documents and Settings\npc.h … |
|
[CODE]# include <iostream> using namespace std; void init(int *Ptr, const int &s); void display(int *Ptr, const int &s); void sort(int *aPtr, int s); void swap(int *v1Ptr, int *v2Ptr); int index_of_next_smallest(int *aPtr, int *SiPtr, int s); int main() { int size, count; int *nPtr; cout << "Enter the size: "; cin … |
|
Okay, I'm making a shooter game, and all my weapons are differnt userdefined objects; ie. the flamethrower works differently then the gun, however, I'm calling some functions in my "main", an example of this would be; [CODE] /* <Init> */ MachineGunClass *CurrentWeapon; MachineGunClass *MachineGun; MachineGun = new MachineGunClass(); CurrentWeapon = … |
|
[B]i need c program for [/B] [B]1.[/B] "[B]menu driven in c program using pointers[/B]. [COLOR="Red"]1.comparition of two strin , 2.length of two string, 3.reverse, 4.palindrome all without using string function" [/COLOR] [B]2.[/B] "[B]menu driven program using pointer with array[/B]. [COLOR="Red"]1.addition of two matrix, 2.subtracion of two matrix, 3.multiplication of matrix, … |
|
As I see in some code having something like "[b]ClassName[u]&[/u][/b]". For example: [code] // this demo // check if a parameter passed to a member function is the object itself #include <iostream> using namespace std; class CDummy { public : int isitme ([b]CDummy[u]&[/u] param[/b]); }; int CDummy :: isitme ([b]CDummy[u]&[/u] … |
|
I would like to know how can the swapping function be implemented using pointers, void swap (int*, int*) [CODE] //function prototypes void swap(int& a, int& b); //function (passing by ref) void swap(int& a, int& b) { int t = a; a = b; b = t; }[/CODE] Is this correct? … |
|
I read this code section from a tutorial, but I cannot understand it thoroughly. It is about Pointer & Class Pointer & Array Pointer. This is it: [code] // pointer to classes example #include <iostream> using namespace std; class CRectangle { private: int width, height; public: // prototype void set_values … |
|
Today I've learned some concepts about Pointer in C++ and I have a confusion in this code snippet and its result. Source Code: [code] // Pointer array #include <iostream> using namespace std; void main () { char * say = "Hello"; // cout << "say = " << say << … |
|
how would this be done [CODE]int main(void) { char string[]="231 number 73 word 1 2"; char *ele; ele=strtok(string," "); while (ele != NULL) { if (*ele == '0' || *ele == '1' || *ele == '2' || *ele == '3' || *ele == '4' || *ele == '5' || *ele … |
|
I guess i'm missing something basic, but i'm new to C++ and do not know how do these streams behave. Can someone please explain why no text is printed to the screen in the following example: [code=C++] #include <iostream> using namespace std; int main (void) { char *ptr = NULL; … |
|
I have an arbitrary number of files whose names I will know and I want to open them for reading. The important point is that I do not want to open them sequentially using a single file pointer. I need to have them all open at the same time. This … |
|
Hello All! I have been working on a network design problem and am having a problem in the following part- What I am trying to do here -- { for every set of edges (a,b), { for all arcs (l,m) assign length of -- arc [l,m] = edge [a,b][l,m] shortest_path … |
|
I am trying to read the value of memory address using c++. For example, how can I read the value contained in "00B12318"? I have tried: [CODE]int value; 00B12318 = &value; cout << value;[/CODE] But sadly it doesnt work. Please help! THank you :( |
|
I got the following code out of Carrano's Walls & Mirrors. I made a few changes but have tested it and it works. I'm really confused by line 19 in the .h file. Why is it structured like "void (*FunctionType)"? Why not (void*) FunctionType? or void* FunctionType? What is the … |
|
Hi, I am trying to implement a Data Manager class (singleton) that initializes data, keep track of memory usage and acts as a data pool for other classes to share the data. My problem lies with the sharing. After considering serveral factors, I want to share data in the form … |
|
I am relatively new to c# and am making a 2D physics engine as a fun project to learn the language and the .NET environment. I am making a form that can be used to modify the number of objects. Unfortunately, I cannot find a way to change the length … |
|
I am writing a method that does insertion into a doubly linked list and I was looking for some assistance with my code to see if I was heading in the write direction and what needs to be fixed to make this work. [B]Instructions[/B] template <class T> Iterator<T> List<T>::insert(Iterator<T> pos, … |
The End.