1,426 Posted Topics

Member Avatar for SyncMr

according to this http://www.boost.org/doc/libs/1_36_0/libs/dynamic_bitset/dynamic_bitset.html You ahould be able to output direclty to your filestream using the << operator. They also have the >> operator set to get a bitset from the stream.

Member Avatar for NathanOliver
0
2K
Member Avatar for learner_new

a `char*` is considered a c-style string. It is just an array of characters. A `char **` is and array of `char*` which is to say it is an group of c-style strings. The string type is an ogject created from the class string. These are two different things. This …

Member Avatar for NathanOliver
0
6K
Member Avatar for grh1107

Just make the void RepMatrix funtion a provate function of the class. That way no one can use except you.

Member Avatar for mike_2000_17
0
3K
Member Avatar for poloblue

• If all of the elements are in order and the entire array is full wouldn’t you just look at the index of id number - 101?

Member Avatar for NathanOliver
0
280
Member Avatar for triumphost

You want to write your own copy constructor for any class that contains pointers. The reason for this is that the default one the compiler makes only performs a shallow copy. This means that the copy will be exactly the same as the original. With pointers this is bad because …

Member Avatar for mike_2000_17
0
4K
Member Avatar for lxXTaCoXxl

Your multiplier array and your code to populate it is the problem. The array is of type int but you are trying to store a double into it. This will just cause a truncation problem for storing the values. The main issue is in your for loop on line 61. …

Member Avatar for NathanOliver
0
238
Member Avatar for oggiemc

I did a google search and it looks like this happenes when either or both g++ and gdb are not installed

Member Avatar for Lucaci Andrew
0
603
Member Avatar for BirdaoGwra

The problem you are having is that you are using an unsigned integer type. When you underflow that type it wraps around to the largest number it can be. You have to be very careful when you get towards the min or max number that your type can hold because …

Member Avatar for BirdaoGwra
0
137
Member Avatar for lxXTaCoXxl

the string type is part of the standard namespace. if you are going to use types from the std namespace in a header file than you will either need to fully qualify the name like `std::string` or you could use a using directive like `using std::string;`. I would not use …

Member Avatar for NathanOliver
0
209
Member Avatar for grh1107

You are calling delete on number in your destructor for your palindorme class. You shouldnt do that. All members of the base class should be taken care of in the base class destructor like you have on line 13.

Member Avatar for mike_2000_17
0
255
Member Avatar for silvercats

It all depends on how you code your program. If you have mechanisms in place in your code to handle error than you could try recover from that error. If that is not possible, than you could end the program gracefully and tell the OS that the program did not …

Member Avatar for silvercats
0
874
Member Avatar for poloblue

if you are having a problem with file IO give this page a shot. http://www.cplusplus.com/reference/iostream/ifstream/

Member Avatar for poloblue
0
1K
Member Avatar for LatSo

My suggestion is pretty much the same as Schol-R-LEA's. I would you a sieve of Eratosthenes to generate all number between 2 and the upper limit for your test. After that I would check and see if the number inputted is in the list. If it is then divide the …

Member Avatar for LatSo
0
713
Member Avatar for JE821

What error are you getting? To try and make finding the problem easier you should try to skim the code down to the smallest thing you can get that still produces the error. Try to fix that and then implement the fix into the larger code that you have. Seeing …

Member Avatar for JE821
0
402
Member Avatar for Albino

It will if you do not have the string header in your struct header file. Please post what you have. Its hard to see your screen from here.

Member Avatar for Albino
0
279
Member Avatar for tubzz
Member Avatar for OrangeTree

I believe the problem lies in the fact that you only have 1 paramater in your function. From functions I have seen you need to have at least one paramater that does not have a default paramater

Member Avatar for OrangeTree
0
154
Member Avatar for Clouded One
Member Avatar for DubyStev
Member Avatar for khuzdaar
Member Avatar for MasterHacker110

Well if you want to parse a string the best way i can think of is to you a stringstream. You get the input from the user using getline like you have and then you would put the string into the stringstream. After that you would output all of the …

Member Avatar for MasterHacker110
0
274
Member Avatar for triumphost
Member Avatar for triumphost
0
225
Member Avatar for MasterHacker110

Do you know how to use cin and cout? Have you heard of get() and/or getline()? Using those you can take anything in from the user you want in almost any way you want it. Generally what you should do is read in the entire line and then parse out …

Member Avatar for MasterHacker110
0
152
Member Avatar for caltech

The reason you are having an issue is you are setting youngest equal to 0 before you start the for loop and as long as you have valid data you shouldnt have an employee with a zero age. // change youngest = 0; // to youngest = recordlist[0].age The condition …

Member Avatar for NathanOliver
0
948
Member Avatar for f4fjks

To continue Tumlee's point if you want the data to be in an unbeadable form than you are going to need to learn how to create a data structure and then write the structure to file in binary. One cavet of this is that text is still text in binary.

Member Avatar for NathanOliver
0
251
Member Avatar for benjamin tan
Member Avatar for Zaqmjua

Since you are dealing with the string class what happenes if you change it from 1 and 0 to '1' and '0' s += '1' s += '0'

Member Avatar for deceptikon
0
124
Member Avatar for Tygawr

So you have a file that is 100MB large and you want to search it for a specific string? how are you storing yor string in your function? do you store a new string for each line in the file or are you putting the entire file into one string? …

Member Avatar for WaltP
0
284
Member Avatar for beginneronce

What happens if you change your for loop to for(markit = mark.begin(), courseit = course.begin(); markit < mark.end(), courseit < course.end(); ++markit, ++courseit) I think the problem you are having is that you are trying to use iterators from temporary objects but I could be wrong.

Member Avatar for beginneronce
0
717
Member Avatar for usernforce

The problem you are having is ring is declared as an int but you are trying to use it as an int array.

Member Avatar for MastAvalons
0
152
Member Avatar for Suzie999

All clear does in this is remove any error flags that might be present in the stringstream object. If you want to empty the stringstream then you want to use the ignore() function. Try replacing [icode]ss.clear()[/icode] on line 59 with [icode]ss.ignore(std::numeric_limits<streamsize>::max());[/icode]. You will need to include the <limits> header for …

Member Avatar for Suzie999
0
260
Member Avatar for triumphost

Ever think about just including the cctype header in your project? If you dont want to do that then what you have looks good as long as CCTYPE is defined in the cctype header file. If you want to check if something is not defined then you would use [icode]#IFNDEF …

Member Avatar for ravenous
0
94
Member Avatar for tiredoy

You do not need a while loop in your function. Think about the steps you need to do to get a factorial. There should be a conditional statment in a secursive function to check if you have reached a base case. There should be a call to the function itself …

Member Avatar for tiredoy
0
171
Member Avatar for logicmonster

You need to use srand() to seed rand before you use it. For a game like yours i would use [icode] srand((unsigned)time(0)); [/icode]. You will need to use [icode] #include <ctime> [/icode] in your code to do this.

Member Avatar for MrEARTHSHAcKER
0
866
Member Avatar for toyotatundra

You cant compare char strings like that. You have to use the strcmp() function. I you want to compare strings with the logical comparison operator than you could use the string class available from <string> or you have to write your own.

Member Avatar for NathanOliver
0
124
Member Avatar for Labdabeta

Yes you can Overide any operator you want. This can be done globally or at a specific level.

Member Avatar for Labdabeta
0
200
Member Avatar for aashishsatya

After line 16 add [icode]cin.ignore();[/icode]. This is beacuse you are mixing inputs and this will clear the '/n' that is left in the buffer after the call to cin with [icode]>>[/icode]. Not 100% sure how [icode]gets()[/icode] works but this fixes the problem when trying to use [icode]getline()[/icode]

Member Avatar for jaskij
0
690
Member Avatar for Shaye12321

Well you can use a counter variable and every time you read a string increment the counter by 1.

Member Avatar for WaltP
0
207
Member Avatar for siabenie

The problem with you logic is that i is starting out at 0 not 1. Since 0 is a number you have 0, 1, 2, 3, ... 98, 99. The reason i is 100 is because when i is 99 it get incremented to 100 and then it is checked …

Member Avatar for amir808
0
136
Member Avatar for cl2020

One of the problems with palindromes is the formatting. In this case you have commas and when you reverse the string they will not line up right but the letters in the sentence is still a palindrome. One solution would be to strip all punctuation and spaces from the sentence …

Member Avatar for youjean
0
337
Member Avatar for surferxo3

I belive you need to increment j after line 27 and before line 28. Otherwise you are always starting back at the same place.

Member Avatar for Lerner
0
234
Member Avatar for mikeshadow

So what you need is more like prime factorization. There are many threads on this site that talk about that.

Member Avatar for mikeshadow
0
506
Member Avatar for LacyMacy

Well for starters an int can not hold decimals. A float or a double is required for that. you can do this with int's if you know how to use the % operator.

Member Avatar for Lerner
0
206
Member Avatar for triumphost

to declare variables in c++ you do it as [code=c++] int x, y; [/code] So with that to declare a structure with an x and y variable you would do [code=c++] struct Point { int x, y; } [/code] Finally if you want to constuct you struct with values when …

Member Avatar for triumphost
0
7K
Member Avatar for black22622
Member Avatar for raptr_dflo
0
4K
Member Avatar for Zvjezdan23

Well I'm not looking at all of this code that's what using a debugger is for but at first glance line 47 is wrong. You are returning an object that doesn't exist. What are you using to compile your code? If you are using an IDE they normally have built …

Member Avatar for thines01
0
123
Member Avatar for Diogo Martinho

Well according to [URL="http://msdn.microsoft.com/en-us/library/5x4fwzb4.aspx"]this[/URL] the buffer needs to be 9 bytes long. Try changing [icode]datenew[8][/icode] to [icode]datenew[9][/icode].

Member Avatar for Diogo Martinho
0
113
Member Avatar for hamby

if you want to get a whole of text uasing cin you need to use [URL="http://www.cplusplus.com/reference/iostream/istream/getline/"]getline()[/URL]

Member Avatar for Mr_Null_andVoid
-1
1K
Member Avatar for Zssffssz

Recursion is a function calling itself. [URL="http://www.daniweb.com/software-development/cpp/threads/401354/1718446#post1718446"]This[/URL] will show you recursion. If you look above that post you will se an iterative version of the same code.

Member Avatar for MastAvalons
0
139
Member Avatar for reallyslick

A linked list can only contain elements of the same type. You could make a list of list like [code=c++] std::list< std::list< int > >; [/code]

Member Avatar for reallyslick
0
144

The End.