482 byte By
BoSCHoW at 2007-11-20 11:35:55
Hi all,i am trying to do a exercise, but i don't quite understand what exactly i need to do . . . the exercise states:Define a pointer to a type double and reserve 1000 places. Then use this pointer as a table with 20 rows and 50 columns. Write a function, in which you will insert the beginning...
1555 byte By
mcmancsu at 2007-11-20 11:35:59
I am using maps with an int key, and a base class pointer as the value. I have a function which sets the value of a passed in key and a get function which retrieves the value of a passed in key. My problem is that I am seg faulting when I do a read on it. I think my problem relates to using the &...
780 byte By
hmmmm... at 2007-11-20 11:36:02
I'm terribly sorry to bring this up again as when I searched I found many threads like it, however most of the other threads dealt with problems with char array's, whereas mine is happening in my first function ever! :(Basically I need to code a function to convert a numeric grade to a let...
Hi, I am supposed to compute a pixel intenisty histogram for an image in c++. i have already read the pixels from the image (code below) but now i have to create a 256 bin histogram that will store the number of pixels having intensity from 0 to 255. i am also supposed to use <argc> <argv&g...
296 byte By
Gasto at 2007-11-20 11:36:10
inline void print(const std::string& str) <br/>Does this make any sense?<br/>it is a reference, so str is intended to be changed where it came from. and const means I can't change it... is there something I am missing. Surely I am or else this syntax shouldn't have any sense.
Hi All<br/>i want to write a program for windows such that.....<br/>on running that exe it will delete itself.<br/>I m using VS 6.0<br/>10x in advance<br/>Sumit
263 byte By
chiku at 2007-11-20 11:36:37
Can anyone suggest some link where I can learn internals of OPENMP. I eventually aim to make few changes in the library itself. Also to understand the working of OPENMP it would be nice to know these stuff.<br/>P.S. I have read the OPENMP specification<br/>Thanks
It has been a while since I have been here, but my interest in computers is perking up again. Anyways, I would like to know if there is a standard way like through the STL to get a listing of files in a directory and there complete paths.
266 byte By
lab1 at 2007-11-20 11:36:47
Hello all,<br/>I have the following code which crashes. Can anyone help me rewrite it so it works as expected?<br/>masses[h] is a vector<float><br/>for(int h = 1; h <= 8; h++)<br/> masses[h] = masses[h]+masses2[h]*credit;<br/>Thanks!
533 byte By
forester at 2007-11-20 11:36:48
There are 3 classes in the win32 project, class A, B and C. In each of the header files of the 3 classes, there is a "#include <windows.h> ", and there are 2 members in the Class A, that is#include <windows.h>...#include "B.h"#include "C.h"Class A(){ Public:B m_b;C m_c;...};So there are...
201 byte By
c94wjpn at 2007-11-20 11:36:50
What's wrong with this?<br/> double coslu[8][] = 0;<br/>devstudio complains about a missing subscript or some nonsense.<br/>How do I fix it.<br/>Sensible suggestions only please
4477 byte By
HockeyZ39 at 2007-11-20 11:36:57
I have to write a program that calculates charges for a ISP provider, there are 3 packages all that charge different rates per the amount of hours used. I have created this program 2 times both in a single .cpp file then in a structured program. Now we are required to set it up as a module and our b...
hi,Im fairly new to c++ programming but have been programming in java for a while so I caught on pretty quick I suppose. I read the full language tutorial on cplusplus.com but there wasn't really that much about header files, only preprocessor directives to include them. I'm current just t...
90 byte By
xnio at 2007-11-20 11:37:08
Hi<br/>say I have a double for loop how can I get the Atrans*A matrix<br/>thanks
Hi,I want to buy a class that builds an array on memory (assigning to each array a name) and after there is a function that, given the name, tries to get a pointer to the previous created array. This is the code of the program. Do you think is effective or should I change things ? plese help me , I&...
If I have the following two functions:<br/>void foo(...){<br/>}<br/>void foo2(...){<br/>}<br/>Is it possible that when foo() is called, it can call foo2() and pass the parameters that are passed to it?
1191 byte By
mph130 at 2007-11-20 11:37:26
Hi, I am a newbie in C++ template, hope someone can explain how to create an instance of a template class. I have a program does nothing, just want to learn how template class works - #include "stdafx.h"using namespace std; template <class T,class B> class MyPtr { public: GCPtr(T *t=NULL,...
250 byte By
tianqio at 2007-11-20 11:37:28
I have heard from others that in c the type is struct compatible while it is name compatible in c++, but they have not given a detail description. Can anyone at here give me the insights of the type compatible and conversion? <br/>thanks very much.
Ok so here's the deal. My assignment is to write a program that computes the primality of any given integer, or whether it is prime or not. I've got that part of the program done, and it works, but i donno if it follows the requirements of the assignment. These requirements are...Your p...
1067 byte By
xlonehats at 2007-11-20 11:37:55
hi guys need some help---how to read all characters from a file and put it into a character array....it also includes spaces....string p, line; cout << "Please enter file path"<<endl;; cin>> p; ifstream inFile; inFile.open(p.c_str...
484 byte By
AvDav at 2007-11-20 11:37:56
Hello.I'd like to hear your opinions about various cross-platform (GUI) frameworks. Which one is better in terms of design, easy usage, size of executable, bugfreenes etc.Currently, I tried wxWidgets, everything is fine, however it generates very huge executable (~4Mb) for a simple application....
232 byte By
George2 at 2007-11-20 11:37:58
Hello everyone,<br/>I think printf %d works fine with signed, unsigned and negative integer values, and the same as %ld for long. Is that correct? If not, do we need to special conversion?<br/>thanks in advance,<br/>George
1901 byte By
madad2005 at 2007-11-20 11:38:07
Hi,First of all, I've got standard C experience for writing mathematical programs that read data in, manipulate it, then write it back out again. I'm now trying to move to C++ and having problems. I can't for the life me work out how to read in a line of numbers from a file and store...
2008 byte By
LPGDEV at 2007-11-20 11:38:15
I am working on Linux and I am trying to use a c++ program which I have written and compiled. It appears as followsvmc_serial.h#include <libplayercore/playercore.h>class VMCSerial{ public: VMCSerial();};vmc_serial.cc#include <vmc_serial.h>VMCSerial::VMCSerial(){ // Do stuff}vmc.h#i...
560 byte By
John E at 2007-11-20 11:38:21
Just over a week ago I checked out the source for a C++ project called 'Ardour' using Subversion. The Ardour project compiles and builds fine using g++ under a Linux distro called 64studio (which I gather is based on Debian Etch).Today I tried to do a svn update but I get the error 'U...
Hi guys,I read that the difference between them isa. The default fields of a class are private while in a struct it's publicb. struct cannot InheritanceI agree with the first one (a), but I did manage to implement inheritance in a class.The thing is that I read it in too many places.....so my q...
Why its not recommended to have a private destructor??<br/>What are the risks involved? and will I ever need it?<br/>Thank again.....
Put the code below in a source file and compile it using Visual Studio 2005 (if possible). Notice that there's first an assert that occurs and after that a heap corruption error message (if you ignore the assert). I'm not really sure why it is acting this way, the code below seems perfectl...
If i try to run this simple program on GCC it gives me a segmentation fault whereas it runs perfectly fine on Visual C++.The code is as follows...#include <stdio.h>#include <malloc.h>struct treeNode{ struct treeNode* parent; struct treeNode* left; struct treeNode* right; int data; char a...
Hi,I use libodbc.a [from unixODBC-2.2.11] and libodbc++.a [from libodbc++-0.2.3] as a static libraries in my program (C++) to connect the MySQL Server.I have created the drivers for the MySQL and created the appropriate DSN . I have tested connectivity externally using 'isql' utility. It s...
462 byte By
Lindley at 2007-11-20 11:38:43
Let's say I've got class A{ virtual void sub(); void doSomething() { sub(); }};class B: public A{ void sub() { printf("Hello."); }};Is there a way to make this arrangement work? Currently, it's causing linker errors; and if I mark sub() as non-virtual in A, it tries to ex...
849 byte By
utkseth at 2007-11-20 11:38:45
HiI am facing a weird problem with my code. I am loading a .bmp file with a bmp loader but it gives me weird error. To make matters worse it works absolutely fine on other machine which have the same version of the Visual Studio I am using. I have attached the BMPLoader.cpp and BMPLoader.h files if...
799 byte By
Rooting at 2007-11-20 11:38:46
hi friends..i have an array whith 22306 variable in it..chars..dinamic arraynot i'd search a name by the array..char *array;array = new char [length];...delete [] array;now there are a structure of array same this:array[1] = carray[2] = oarray[3] = darray[4] = earray[5] = garray[6] = uarray[7]...
1492 byte By
mph130 at 2007-11-20 11:38:56
Hi, I don't see where can I add "code tag" to my attached codes, do I need to post a certain # to be able to do it?Here is my question, I have two classes, I want to call a public function in the first calss which in turn calls the second class. I"thought" I can save the pointer of the second c...
#ifdef HAVE_CONFIG_H#include <config.h>#endif#include <iostream>#include <cstdlib>using namespace std;bool yes(){ string ans; while (true) { cin >> ans; if ( (ans == "Y") || (ans == "y") ) return true; if ( ans == "N" || ans == "n" ) return false; if (ans == "Q" || ans...
1672 byte By
SamWo123 at 2007-11-20 11:39:09
Hi.I am getting errors when trying to define a friend template member function of a template class.I started with just a friend function inside a template class. There's no problem.//complex_c.cpptemplate<typename T> class complex_c{ public: T i; T q; complex_c(){i=0; q = 0...
777 byte By
newms86 at 2007-11-20 11:39:28
I am trying to figure out how to overload the assign operator= for an array of my class objects Square.I have declared Square *Cube[27]; and filled up the cube with square objects I want to overload operator= in:Cube[2] = Cube[3] for example. I know how to overload for a square object alone, but is...
485 byte By
yaniv_av at 2007-11-20 11:39:41
Hi, What's wrong with this code?typedef std::map<DWORD, std::vector<std::wstring>> IntervalsMap;I get lots of compiler's errors...When I'm spliting it, like that:typedef std::vector<std::wstring> strvec;typedef std::map<DWORD, strvec> IntervalsMap;it's ok....
Hi EveryoneCan someone please clear a point of confusion for meMy current design has a base class that has several classes derived from itThe base class has a virtual method for which it provides an implementationto do some work that is required for all classes in this hierarchy.So dervived classes...
Hi guys,I have this simple overload function:void FindID(double num){ cout<<"I'm Double!"<<endl;}void FindID(float num){ cout<<"I'm Float!"<<endl;}int main(){ FindID(0.4); return 0;}It seems like any value I pass to it will "trigger" the double function,0.4, 1....
Hi guys,<br/>Is it possible to allocate memory using malloc() (C) and release it using delete (C++)<br/>or even the opposite<br/>Alocate with new (C++) and release with free() (C)<br/>If not Why?<br/>Many thanks.....
2196 byte By
BoSCHoW at 2007-11-20 11:40:24
Hello friends,i have a new problem with another exercise. It states like this:Imagine that we have a program that requires the informations of the user. for this purpose write a function Insert, that will look after the users informations. Because the function has to be general, its parameter should...
Alright hey guys and gals. I have a question for all of you. I am a newbie programmer and I am trying to finish out this code so it will pop up with the message I have in the stars however I have no idea how to go about this. Its on my college professor's linux server (Red Hat core 7) which we...
741 byte By
douche at 2007-11-20 11:40:42
Hi, I've looked hi and low and cannot find the line of code that calculates interest earned. For example, a user enters the values in year 1 and the rest is calculated based on those first entries:Year Balance Interest Earned Additional Deposit Result1 1000 65.00...
Hi,allI want to write compare function of set, but failed.the following is the codes, I can compare a,b or c,d separately.but when I want to combine them in a set, it failed.#include <set>#include <iostream>using namespace std;const int LINE_SEG = 1;const int CIRCLE_SEG = 2;class Segme...
225 byte By
Jacko123 at 2007-11-20 11:40:47
Hello All,<br/> What is the difference between the two?<br/> int (&pFunc)(int, int); -- 1<br/> and<br/> int(*pFunc)(int, int);-- 2 <br/>Why would someone write code as in 1 above?<br/>Thanks in advance.
506 byte By
MFCQuery at 2007-11-20 11:40:59
Hi,To set the mouse position in windowsPOINT pt;pt.x=pt.y=100;ClientToScreen(GetActiveWindow(),&pt);SetCursorPos(pt.x,pt.y);here we need to change client coordinates to screen coordinatesTo get the mouse position in windowsGetCursorPos(&pt);ScreenToClient(GetActiveWindow(),&pt);// to get the coordin...
hey, we just started learning about functions, and i'm trying to write a grade program using functions, but looks the functions are talking with eachother and i'm not sure why. i've made a function for the numeric grade, letter grade, grade sign and then the output, any tips? thanks g...
732 byte By
LPGDEV at 2007-11-20 11:41:36
HiI am trying to read commands from a serial port in linux. I am able to open it, write commands to it and receive command strings back. The hardware on the other end sends a ACK (0x06) command as confirmation when it receives an incoming command. What I have at the moment is this...char buf [255];w...
706 byte By
Lindley at 2007-11-20 11:41:38
This is actually a C question rather than C++.If I've got a union, is there any way to take a pointer to a particular member of it, so that the currently "active" member of the union can be abstracted away?In C++ I'd just do something with operator overloading, but that isn't an optio...