Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

0 Endorsements
~11.8K People Reached
Favorite Forums
Favorite Tags
c++ x 24
Member Avatar for Peyton

Hi, I was given this class member function that overloads the == operator. I don't understand it. Please could you help me understand it? Here is the class [CODE]class Word { public: // constructor Word(const string& word); // overloads is-equal-to (or equivalence) operator - this is very useful for testing, …

Member Avatar for Peyton
0
147
Member Avatar for Peyton

Hi there, I have been trying to figure out the common recursion problem given in e.g. 6.42 in the following link: [URL="http://net.pku.edu.cn/~course/cs101/resource/CppHowToProgram/5e/html/ch06lev1sec28.html"]Towers of Hanoi[/URL]. After a few hours I still can't figure it out, even though I've got the code: [CODE=cplusplus]#include <iostream> using namespace std; // num disks void Towers(int …

Member Avatar for csurfer
0
122
Member Avatar for Peyton

Hi there, I'm having a problem with the code below: [CODE]#include <iostream> #include <cstdlib> #include <ctime> using namespace std; void setArray( float [], const int Size ); void displayArray( const float * ); int main() { const int arraySize = 20; float array[ arraySize ]; // Initialise the array: setArray( …

Member Avatar for Peyton
0
104
Member Avatar for Peyton

Hi there, Say I have the following while loop, that loops on the condition that a lne (a string) is received from a file: [CODE]while ( getline( inData2, line ) ) // Increment rows till none left { if ( !line ) { cout << "No data entered. Please enter …

Member Avatar for William Hemsworth
0
147
Member Avatar for Peyton

Hi, I am having a problem with the following function: [CODE]void calcEnergy( vector< vector<double> > &Energy, vector< vector<double> > &Data, const double Constant ) { double Time = 6; // store the change in time double energy ; // Temp variable to store energy double v1,v2; for ( size_t i …

Member Avatar for ArkM
0
106
Member Avatar for Peyton

Hi there, Say I have created an ifstream object in main(): [CODE]ifstream [B]inData[/B]; // Create new input file stream object inData.open( "input.dat" );[/CODE] How could I then pass this object to a function, instead of having to recreate it there? I.e. what would the argument and parameter look like? Thanks …

Member Avatar for ArkM
0
10K
Member Avatar for Peyton

Hi there, I am having a problem with the following code: [CODE]#include <iostream> #include <string> #include <fstream> using namespace std; int findRows( string line ); int main() { string line; int rows = findRows( line ); cout << "Number of rows: " << rows << endl; } int findRows( string …

Member Avatar for Peyton
0
156
Member Avatar for Peyton

Hi there, The Wallis product is defined here: [url]http://en.wikipedia.org/wiki/Wallis_product[/url] I am having a problem with the following code, which attempts to approximate the product: [CODE]#include <iostream> #include <cmath> using namespace std; int main() { int n = 2; // initialise top counter as 2 for the first two terms int …

Member Avatar for greg022549
0
1K