473,544 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C / C++ Forum

C / C++ programming language - Get answers to questions about compilers, visual C++, templates, namespaces, classes, data structures, OOP (object-oriented programming), inheritance, data types, exceptions, Standard Template Library (STL) and the C Standard Library.
3
1,663
thread by: Gonçalo Rodrigues | last post Jul 23 '05 by: Bushido Hacks
Hi all, I have a base class, call it Object, that implements operators new and delete. Now suppose there is also a class, call it Derived, deriving from Object. It has the feature that *all* its instances are statically allocated so I have to override new and delete. Since *all* instances are statically allocated (and already fully
3
1,663
thread by: Aaron Walker | last post Jul 23 '05 by: Default User
I have a feeling this going to end up being something so stupid, but right now I'm confused as hell. I'm trying to code a function, that given a string and a delimiter char, returns a vector of the sub-strings. Here's what I have (I've thrown a main() in there for this mail). --- #include <iostream> #include <string>
2
1,663
thread by: puzzlecracker | last post Jul 23 '05 by: Rolf Magnus
B.S. page 271: class complex { double re, im; ... public: ... }; comlex::comple(complex c):re(c.re), im(c.im){} //error
3
1,663
thread by: Rüdiger Knörig | last post Jul 23 '05 by: Rapscallion
I've a nasty problem here (g++ 3.4/4.0): I've a template datatype mltreenode<T> from which I instanced a STL vector vector< mltreenode<T> * > without any problems. Calling methods on this object (e.g. push_back()) doesn't cause any problems. But when I try to instanciate an iterator like this: vector< mltreenode<T> * >::iterator worst_elem;...
5
1,663
thread by: cmk128 | last post Oct 4 '05 by: Mirek Fidler
Hi C++ should provide us bit shift but fill with 1 rather than 0. Or i am wrong, c++ have it??? if 1 left shift 2, i want 111 rather than 100 thanks from Peter (cmk128@hotmail.com)
10
1,663
thread by: repairman2003 | last post Oct 25 '05 by: repairman2003
Considering this struct: typedef struct ServiceRecord { vector<string> service; vector<Date> date; } ServiceRecord; Date is declared elsewhere as:
6
1,663
thread by: kelvSYC | last post Nov 13 '05 by: Dave Thompson
How do you iterate through an array of structs? I tried something like this and it doesn't work (my compiler says "illegal operand"): struct foo f; for (i = 0; f; i++) { // Insert code here } -------------------
20
1,663
thread by: Kamilche | last post Nov 14 '05 by: goose
You know, all this furor over this book caused me to go look it up on Amazon. I've never read this book... but from what I can see from the legally available table of contents, excerpt, and index at Amazon, it looks more like a "Teach me newbie C" book than a "UNCOVER DEEP MYSTERIES OF C!!" sort of affair. I've got a better idea! Let's...
5
1,663
thread by: elzacho | last post Nov 15 '05 by: Malcolm
I would like to (and commonly do) define my variables in the most specific scope I can. For example... int foo(int a, int b, int c) { /* don't declare temp here if we can help it */ ... for (i = 0; i < max; i++) {
5
1,663
thread by: jmsantoss | last post Feb 4 '06 by: Victor Bazarov
Hi, This is a design question. I have a class named "DataBuffer" that stores some data. After "DataBuffer" is created it can not be modified. All the methods of "DataBuffer" are const as data can not be modified after it was created. Up to here everything is fine. The problem is when I want to get clever with data storage. My program has...
8
1,663
thread by: Marcus Kwok | last post Feb 11 '06 by: davidrubin
Given a user defined class with a default constructor (let's call the class C), is there any semantic difference between C* c = new C; and C* c = new C(); ? I am thinking they are equivalent, as demonstrated by the program
1
1,663
thread by: poison.summer | last post Feb 24 '06 by: Ian Collins
Hello I use the following function to print out the time. But I wonder whether I can be more accurate like print out the microsecond Thanks a lot! void Print_time() { time_t now;
10
1,663
thread by: jeniffer | last post Apr 28 '06 by: Keith Thompson
char *a="this is a string"; char a="this is a string"; first is a pointer while second is an array.Tell me more differences
3
1,663
thread by: mrbrightsidestolemymoney | last post Jun 1 '06 by: Michiel.Salters
Hi, I need to write out a 1d array of 2d arrays (the structures for each are custom, a 3d structure is defined but not suitable for my use for a number of reasons). Templated routines exist for writing out multi2d<T> and multi1d<T>, hence writing multi2d<multi1d<T>> is possible, although fails for some unknown reason. There is a...
0
1,663
thread by: TVR | last post Jun 16 '06 by: TVR
Hi I am busy writing a program in CORBA.It is about a bank and it's accounts .I am doing this in CORBA.The client has to enter he's name and password.Then these details should be send to a function in the header file open(name,passw) which should greate a new account if the name is new else it should return a reference to the already greated...
1
1,663
thread by: krishnatangirala | last post Jul 17 '06 by: red floyd
Hi, I am trying to develop a dll with JNI using C++ with Visual studio 2005 and JDK1.6 beta2.0 I wanted to know if i should generate the dll with /MD option or /MT option. Also, i was reading in the internet about this and i came across something related to embedding maifest within the dll.. not sure how this whole thing works. i also...
2
1,663
thread by: harendra | last post Jul 28 '06 by: Flash Gordon
hello friends, I have log of the system call called by the windows process. I want some good algorithm may be of neural network etc ...... to find pattern for the windows process , Kindly help me .
2
1,663
thread by: Kai | last post Nov 15 '06 by: christine0207
ok say I have a program that outputs RRYYPP GGBBPP YYRROO VVBBGG for example. How would I find a value in the array and have it output something like this:
1
1,663
thread by: ag203 | last post Dec 6 '06 by: willakawill
we are working with functions andn I've declared the function at the top...but I'm not sure what to actually out in it. We have to flip the sentence backwards... like say I love cats. we need to output to the user: .stac evol I can anyone help me??
3
1,663
thread by: kalyankiran33 | last post Jan 3 '07 by: thefarmer
I have com across a program in which I should take 17 as a global constant. I have to take 17 inputs. for those inputs .. I have to find the number of even numbers entered the number of odd numbers entered the number of prime numbers entered smallest number among those 17 largest number among those 17 factorial of the smallest number
6
1,663
thread by: Chameleon | last post Jan 6 '07 by: AnonMail2005
I am confused on this: When "new" fails, what happens? - throws bad_alloc - returns 0 I found many docs with first, many with second and one with both(!) cases. thanks!
4
1,663
thread by: Bill | last post Jan 26 '07 by: mark_bluemel
Hi all, I've got some code which monitors a file by way of the kqueue/kevent mechanism but I'm having trouble getting it to shut down cleanly. My thread dedicated to the kqueue is basically a while-loop which blocks on the kevent() call until an event is posted, at which point it rattles through and does what it's supposed to. So far so...
2
1,663
thread by: childofthehorn | last post Feb 6 '07 by: childofthehorn
Okay, so I can get this to read the first line of a txt document. I just can't figure out how to get it to read the next lines. I have to use "user_input" in a function. The wait function just waits until the user hits enter. The text document has 11 lines of code. I know this is a total newb question, but I am baffled. The function gets called at...
4
1,663
thread by: nozyrev | last post May 3 '07 by: James Kanze
Hi, I apologize in advance if this is a very dumb question. I've been struggling with this problem for some time: I have an abstract base class called Base and n derived classes D1, D2, ....Dn. I would like to have a constructor for each derived class that takes any of the other derived classes as an argument so that these statements are...
2
1,663
thread by: =?ISO-8859-2?Q?Rafa=B3?= Maj | last post May 24 '07 by: Howard
Say we have a class Model (a 3d model) and class Texture (representing an Texture). Model have a texture, Model can be Drawed. Texture have method that returns data needed for drawing. class Texture { public: // openGl data here glInt GetInt();

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.