General C++ Programming - May 2010 (Page 15)

creating directories
 
Hi, I run my code on windows and mac as of now. Is it possible to create directories from within C++ under a specified path? If so I require that the directo...
[2 replies] Last: Thank you. seems exactly what I was looking for... (by pozdrav)
by justme
string
 
i am trying to generate random ss number as a string by using the rand fuction with heap sorting method how do I go about to do that
[8 replies] Last: I am trying to write this program to get random ssn using selection so... (by justme)
State Design Pattern in C++
 
hi, i got that question from a friend who interviewed for a job the following code implements State protocol, explain how : #include "stateMachine.h" /...
[no replies]
Randomizing Pictures
 
Hey. I was wondering if anyone knows how to choose a random picture from a file of pictures. The program I am working on is BINGO, and I am trying to do it with...
[3 replies] Last: Okay. Never mind. I figured out how to do it. I had like 81 individ... (by cadencej)
Add operator with assignment operator
 
I overloaded =,+= and + operator for a custom template class. Here are my codes. template <class vtype> inline matrix<vtype>& matrix<vtype>::operator=(ma...
[2 replies] Last: I tried to duplicate with my own simple example using global functions... (by kempofighter)
Algorithm question
 
An algorithm takes 0.5 ms for input size 100. How large a problem can be solved in 1 minute if the running time is the following assume loworder terms are neg...
[1 reply] : This is a problem probably given as homework, and therefore we will no... (by Albatross)
Automatic change of variable value
 
Hello, Need a litle help with a problem. It is posible to automatically change the value of variables? For example: If i have 2 variables: "a" and "b", a...
[3 replies] Last: You could use a class: AandB.cpp #ifndef _CLASS_H_ #define _CL... (by closed account 1yR4jE8b)
call function from a const ref. object
 
I am trying to overload an assignment operator of a custom template class. Here is my code. template <class vtype> inline matrix<vtype>& matrix<vtype>::op...
[3 replies] Last: IINM, if you leave two overloads, one const and one non-const, the com... (by helios)
how this statement work ?
 
Hi,everybody watching my topic. I read the Effective STL book and encounter an a statement like this below vector<Contestant>(contestants).swap(contestants)...
[3 replies] Last: Its true. The compiler crated the temporary and the compiler will dest... (by Galik)
by helios
Sockets and routers
 
Any idea why connecting to a computer that's behind a router would fail even when all the ports are forwarded? I know it's possible to connect to the socket bec...
[no replies]
sweep generation
 
Hello everybody, I'm trying to generate a sweep in C++. vector<float> vOut_t; int length = fs*T; float value; float K = 2*PI*f1 * T / (log...
[4 replies] Last: Hello Imi, I could solve it. It's not only necessary to change v... (by jomammele)
by pmzf
vector and nested classes
 
Hi, I am using <vector> with an interface like, vector<interface*> b; and then filling the container as follows, b.push_back(new derived_class...
[4 replies] Last: Hi, Sorry for late reply, have been without internet for a few days bu... (by pmzf)
Few Basic Questions
 
1. Can Pure Virtual Functions Be Overloaded? I know we can (must) override Pure virtual functions in the derived class but can we overload them? I mean if ...
[3 replies] Last: Galik (88) - Thanks very much for your reply. That Parashift link wa... (by flower07)
Why not: using namespace std;
 
Hi, I know this has been discussed but ... Why showld i use ... #include <iostream> using std::cout; int main() { cout << "hello\n"; return 0; } ....
[3 replies] Last: Who said you should use using at all? Are you refering to this ap... (by graciano)
use of dlls
 
Hey,I am a newbie.I just would like someone to explain main reasons for occurence of linking errors in Visual Studio 2005; and where exactly do you need to put ...
[no replies]
Sorting Strings
 
Hi,I am printing out information and it works successfully, however i wish to print it lexicographically\alphabetically by comparing the last name strings store...
[2 replies] Last: Cheers r0shi, will give this a go. (by Dlockwood)
weighted dice throw
 
I need to create an algorithm to return a number between 2 and 12, as in a dice throw, which is weighted so that I can control whether a more or less probable n...
[11 replies] Last: First, I am sorry - I haven't read all the answers. Maybe my solution ... (by imi)
Why NOT use new with free?
 
I have been to an C++ interview recently and they asked me the question - "Can we use free keyword to free the new'ed memory?" I said, "We can. It is technicall...
[2 replies] Last: Hey Imi, Thanks a lot for your reply! All these days... I was th... (by flower07)
by Azimer
Split screen display with a win32 console app
 
I am writing a hangman game program for class which outputs to the windows command prompt. I would like to have the top half or third of the command prompt disp...
[7 replies] Last: It would blink each time you used it, and it is a security hole, but y... (by Duthomhas)
by Deluge
rand() - Same Ten Digits Printed -- Random?
 
I must be using the rand() function wrong, because every time I run this program, even after recompiling, it prints out the same ten digits: 3675356291 cod...
[2 replies] Last: Thank you very much. (by Deluge)
May 2010 Pages: 1... 1314151617... 22
  Archived months: [apr2010] [jun2010]

This is an archived page. To post a new message, go to the current page.