General C++ Programming - April 2008 (Page 4)

Random Number Generation with Blitz
 
Dear all, I am running blitz 0.9 and g++ (GCC) 3.3.3 (SuSE Linux). I wrote a test program 'beta.cpp' to generate a random number from the beta distributio...
[1 reply] : Try to replace: Beta<double> betaGen; betaGen.setPara... (by ropez)
Decimal Value of the Ratios of Consecutive Fibonacci Numbers
 
Hi, I was hoping someone could shed some light on this for me. I am stuck on an assignment. I have spent 3 weeks on it and have almost finished it. I have so...
[1 reply] : Give some thought to what the word "ratio" means, and look at the firs... (by JivanAmara)
string
 
case1:char* a="cplus"; cout<<*a; //outputs c cout<<a ; // outputs c case2:char e ="cplus"; cout<<*e; // outputs c cout<<e ; //outouts c case3: string s="c...
[2 replies] Last: Google "Thinking in C++" and download the PDF. (by medievalelks)
by naja
is it possible to reduce redundant code like this?
 
hi, Im writing a hash calculator. This means that a lot of stuff in my code exists for each algorithm... I was wondering if things like the code below, whic...
[1 reply] : Use polymorphism: class Calculator { virtual void onBoxStat... (by medievalelks)
by Yersey
How to exhaust all available dynamic memory in computer?
 
Hello
[6 replies] Last: It's not just enough to allocate the memory. You have to write to it ... (by jsmith)
by mb108
Iterator question -- templates
 
I know I'm missing something, and I'm hoping somebody can explain to me why this generates compiler errors: template<class T> class signal { vector<slo...
[5 replies] Last: I tried it and it worked, but my testing was sloppy. Here's what work... (by mb108)
Manipulating 2d arrays need help
 
I have a project for my c++ class, and in that project I have to read in from a file a number indicating how many matrixis are in the file. Followed by the size...
[1 reply] : This looks pretty good so far, except that your declaration of A limit... (by jsmith)
strcmp problems... pointer 2 private pointer
 
LOTS of source to look at here, basically it does everything I want it to but properly compare the values of both pointers and upon looking at their values in t...
[1 reply] : I think your problem is in this section of code in addWord: if( ... (by jsmith)
by sparky
cin.getline() not working
 
Hello, Why does my cin.getline(); not work sometimes? In these circumstances, I am forced to add another cin.getline to get it to work but I really want to u...
[8 replies] Last: rpgfan3233, you know, I reread your post several times and it has n... (by sparky)
Memory Release Problem
 
I have a problem with releasing memory. I have made a test program that demonstrates the problem I am having. The problem is, I have a class with a private ...
[2 replies] Last: Note that I said in the description that 10000000 probably wouldn't wo... (by chronicle)
cannot convert parameter 1 from 'std::string [12]' to 'double []'
 
ive been getting this error(error C2664: 'getRainfall' : cannot convert parameter 1 from 'std::string ' to 'double ') since i started to code my program , a...
[2 replies] Last: well the thing is i have an assignment and, the array must be double t... (by lothrodel)
Introduce OFDMA into ns-2
 
Hello, I'm considering to introduce OFDMA in ns-2. In ns-2, a network simulator, it develop applications in C++. So, OFDMA is a multiple access method, that ...
[no replies]
by sparky
char[] comparison
 
Hello, How do I compare the values stored in char arrays? Any assistance will be appreciated. Thanks in advance. int main() { char name[ 50 ]; char ...
[2 replies] Last: rpgfan3233, It worked!Thank you very much for your help. (by sparky)
Trimming a string
 
I have to write a function for my program on trimming a string. This is what I have to work with. char *str_trim(char *); This function will remove all s...
[1 reply] : Setting aside the fact that there are a zillion easier ways to do it..... (by jsmith)
class(scope)
 
class a{public: void sat(){x=6;y=5;} int x; private:int y;}; DOUBT: in above class in member function sat "x" variable is used before its declaration. you ...
[1 reply] : The C++ compiler is a multi-pass compiler. On the first pass, the com... (by jsmith)
function inside
 
#include<iostream> using namespace std; void f1(){ cout<<"entered into f1"; void f2(){cout<<"entered f2";} } int main(){f1(); system...
[1 reply] : Neither C nor C++ allow you to define functions within other functions... (by jsmith)
INDIRECTLY
 
I HAVE READ THAT MEMBER FUNCTIONS OF A CLASS CAN ACCESS THE MEMBER DATA BUT INDIRECTLY. WHAT DOES THIS INDIRECTLY MEAN IN THE ABOVE STATEMENT.
[1 reply] : This means: "Do NOT shout!" (by Repentinus)
by sparky
Structs with a Class
 
Hello, I keep getting the following error when trying to use structs within a class (see code below): "invalid use of 'struct node::person' " Any assi...
[3 replies] Last: If you're using it as newNode->person->FNAME, it would be declared ins... (by rpgfan3233)
Need Help with Winsock downloading (small errors)
 
I have this code here and it keeps getting small errors in what it downloads, which end up corrupting the files (.zip and .rar), it is also unable to get conten...
[no replies]
by lank23
help with find and replace
 
Hello; I wrote this program read a text file and find "0,to 9," and replace them with "0 to 9 " Note there is a space after the digit instead of a comma. F...
[no replies]
April 2008 Pages: 123456... 11
  Archived months: [mar2008] [may2008]

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