|
More site info...
C++ (Non Visual C++ Issues) | Forum profile
|
|
Forum profile page for C++ (Non Visual C++ Issues) on http://www.codeguru.com.
This report page is the aggregated overview from a single forum: C++ (Non Visual C++ Issues), located on the Message Board at http://www.codeguru.com.
This forum profile page summarizes the general forum statistics such as: Users Activity, Forum Activity, and Top Authors, which are reported in either a table or graph below for a given reporting time period.
Additional forum profile information for "C++ (Non Visual C++ Issues)" on the Message Board at http://www.codeguru.com is also shown in the following ways:
1) Latest Active Threads
2) Hot Threads for Last Week
Warning: These statistics are generated using 'best efforts' and can experience delays and reporting errors at times. Please note that such statistics do not constitute a forum's popularity and/or exact posting volumes at any given reporting period.
|
|
|
|
|
Posting activity on C++ (Non Visual C++ Issues):
|
|
Week
|
Month
|
3 Months
|
|
Threads:
|
129
|
538
|
1,694
|
|
Post:
|
413
|
2,019
|
6,585
|
|
|
C++ (Non Visual C++ Issues) Posting activity graph:
|
Top authors during last week:
user's latest post:
Problem with "delete[]"
Published (2009-11-05 11:04:00)
Quote: Originally Posted by JohnW@Wessex The only advantage I can see to introducing home made containers early on is that when you get to use the STL you think, "Thank God I don't have to do all that new/delete/pointer code any more!". Maybe, but the problem with this is that the "let's make them do this hard stuff first" type of teaching discourages many students, maybe turning them off from...
user's latest post:
Segmentation Fault
Published (2009-11-06 00:14:00)
1) Every new must be matched with a delete (and new[]/delete[], and malloc/free). 2) If there is no new/new[]/malloc/calloc, then there is no need to explicitly free anything.
user's latest post:
Output not displayed until after...
Published (2009-11-05 12:10:00)
I recommend using getline instead of cin for retrieving strings from the console. Code: #include <iostream> #include <string> void bigInt::readBigInt() { int number; std::string digitString; // getline also gets rid of the '' so that you don't end up // with the extra carriage return remaining in input stream. std::getline(std::cin, digitString); makeEmpty(firstp); for(unsigned int i = 0; i <...
user's latest post:
Design problems
Published (2009-11-03 12:12:00)
A web-forum like this one right? Start with a few core classes like: Visitor, Account, Thread and Post. Visitors can be members and have an Account. Threads can be started and filled with Posts. Then think about the needs of these classes and how they relate to each other. Objects of all these classes need to be stored somewhere in memory so you'll need different classes for that. In principle it's the Visitor objects that drive the...
user's latest post:
friend and namespace problem
Published (2009-11-06 02:16:00)
You asked about namespace scope resolution and its relationship about friendship. No where in the OP had you mention anyting about preprocessors. You don't know the half the trouble obfuscating the C++ code through preprocessors can bring And templates? you were talking about templates? Oh fock me, I didnt' know that.
user's latest post:
Array seperation
Published (2009-11-05 15:41:00)
The content of the Vodd array is, after the function call, only defined for the range [0..Nodd). You are looping over the larger range [0..na), thus printing out uninitialized values. Likewise for Veven. Edit: And please, please read the FAQ on how to use code tags !
user's latest post:
Concatenating Dynamic Arrays
Published (2009-11-05 15:35:00)
Quote: Originally Posted by jmorales and wut do you mean by define some special notation for wut it means to concatenate? That is the crux of what you are asking: what does it mean to concatenate something to another? If they are arrays of the same type, then an obvious meaning is to append the elements of one array to another, perhaps creating a new array. If not, what it means is up to you, but presumably the operation would involve some...
user's latest post:
Output not displayed until after...
Published (2009-11-05 06:49:00)
Quote: Originally Posted by treuss What you observe is one of the many nasty side effects of using system. The system command will delegate a simple task (waiting for the user to hit a key) to an external program. I/O of the external program is not synchronized with the calling program, leading to mixup of output. Question: Why should your program wait for the user to hit a key before terminating in the first place? So, don't use system,...
originalfamousjohnsmith
12
user's latest post:
static function to call member...
Published (2009-11-04 04:30:00)
Why don't you have a static class member instead and just change that? Have the objects themselves check it before they do anything to see if an update is needed.
|
|
|
|
Latest active threads on C++ (Non Visual C++ Issues)::
Started 4 days, 6 hours ago (2009-11-05 14:07:00)
by potatoCode
Your example does show that the standard is correct.
Quote:
Originally Posted by C++ standard
Function declarations at block scope and object declarations with the extern specifier at block scope refer to declarations that are members of an enclosing namespace,
is equally saying
Code:
namespace nsC
{
...
Started 3 days, 21 hours ago (2009-11-05 23:21:00)
by pi3orama
String "hullo" should reside in data section, the memory is allocated when the program loaded and never and needn't be free, because it has only 1 copy during the program execution.
You can try to modify the string:
wee[1] = '\0';
you should receive a SEGFAULT because it in data section and readonly.
If you look at the address of "hullo", you should find that it is 0x08xxxxxx, very ...
Started 6 days, 18 hours ago (2009-11-03 02:40:00)
by Ruined Embrace
Code:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
string lastName;
double number, target, parkingSticker;
const double SENTINEL = 000000;
cout << "Please enter a parking sticker number (enter 000000 to exit): " << endl;
cin >> target;
while (target != SENTINEL)
{
ifstream input("HWK5.txt");...
Started 5 days, 17 hours ago (2009-11-04 03:28:00)
by VictorN
Quote:
Originally Posted by schrummy
my questions are; Why the 5 is put to the next line, same with the 4 and the 9? and Why is there a 0.
Well, what output would you expect?
Quote:
Originally Posted by schrummy
Code:
if (count == 0)
...
Started 3 days, 22 hours ago (2009-11-05 21:55:00)
by jzimmerman2011
the code was wrong, here is the right version... (childNodes is an array)
#include <string>
#include <iostream>
#include <cctype>
using namespace std;
class TrieNode
{
private:
char data;
bool isWord;
TrieNode childNodes[26];
public:
TrieNode()
{
}
TrieNode(char argData)
{
data = argData;
isWord = false;
}
void setIsWord(bool ...
Started 4 days, 1 hour ago (2009-11-05 19:50:00)
by VladimirF
It would help a LOT if you would insert comments (with the steps from that algorithm) into your code, so that you can see what is done and where.
Something like that:
Code:
// positive integer I is given
void factor(int I) {
// P = 1
int P = 1;
int mult;
// while (I > 1)
while (I > 1) {
// P = P + 1
P = P+1;
// what is this ...
Started 4 days, 1 hour ago (2009-11-05 19:28:00)
by bitshifter420
You mean like...
Code:
srand(time(NULL));
But you should cast like...
Code:
srand((unsigned)time(NULL));
I bet your compiler would complain everytime if you build all .
|
|
Hot threads for last week on C++ (Non Visual C++ Issues)::
Started 1 week, 1 day ago (2009-11-01 11:57:00)
by Paul McKenzie
Quote:
Originally Posted by phamster
Hey guy, I have a text file and stores each line into a link list. how do I sort my link list by my varible call myIntPacket?
First, please re-edit your post to use code tags. The code you posted is practically unreadable.
Second, is there a reason why you just didn't use ...
Started 1 week, 3 days ago (2009-10-30 06:59:00)
by ltcmelo
I cannot say that for sure because you didn't post all the code.
The hidding situation is in accordance to the standard. This happens even for non-templates classes. The C++ lookup mechanism will not look further for in other scopes if it already finds a name match in the current class. Example:
Code:
struct A
{
bool IsValid(int i) const {return true;}
};
struct B : A...
Started 5 days, 17 hours ago (2009-11-04 03:28:00)
by VictorN
Quote:
Originally Posted by schrummy
my questions are; Why the 5 is put to the next line, same with the 4 and the 9? and Why is there a 0.
Well, what output would you expect?
Quote:
Originally Posted by schrummy
Code:
if (count == 0)
...
Started 6 days, 1 hour ago (2009-11-03 19:47:00)
by xPudgyx
I just started learning c++ basically fresh out of the Hello World program. I'm trying to fix this. Love challenges.
Started 5 days, 15 hours ago (2009-11-04 05:40:00)
by VictorN
Quote:
Originally Posted by Kl2eativ
... I have no idea if this works because cannot compile due to the file not being found!!!Location is right!! I have also tried "Data.txt" and same error!!
Could you show the exact error message?
Started 1 week, 2 days ago (2009-10-31 15:56:00)
by potatoCode
Code:
complx &operator + ( double d, complx c)
{
complx result (d + c.Real(), c.Imaginary());
return result;
}
You're returning a reference of a temporary object, don't do that.
Assuming your ctor and dtor are fully defined,
code such as 9.5 + foo should compile fine. (foo is of complx)
and of course, there are many improvemenets you can work with the complx ...
Started 1 week, 2 days ago (2009-10-31 20:34:00)
by originalfamousjohnsmith
If it's not safe now, would chaging it to something like:
classAllocator = createClassAllocator() do the trick???
Started 6 days, 18 hours ago (2009-11-03 02:40:00)
by Ruined Embrace
Code:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
string lastName;
double number, target, parkingSticker;
const double SENTINEL = 000000;
cout << "Please enter a parking sticker number (enter 000000 to exit): " << endl;
cin >> target;
while (target != SENTINEL)
{
ifstream input("HWK5.txt");...
Started 5 days, 22 hours ago (2009-11-03 22:01:00)
by potatoCode
Quote:
Originally Posted by acdougla17
Code:
void readFile( ifstream &someFile)
{
while (someFile >> num) ; //Not sure what this does and think this is what is causing me issues.
}
someFile >> num will read formatted data upto the whitspace,
so putting that in a loop is ...
Started 6 days, 6 hours ago (2009-11-03 14:45:00)
by laserlight
You declared the vector, but never defined it. Define it in a source file. You probably need to have the destructor remove the object from the vector.
|
|