1,426 Posted Topics

Member Avatar for kshahnazari
Member Avatar for Sasquadge
Member Avatar for tealpenguin

This is the line with your first error cout << "Congrats! Your score is: \n" << getline(cin, x.score) << endl; Right now you are trying to use getline to display a value which will not work. You are also getting the error about x not being declered here. x should …

Member Avatar for NathanOliver
0
218
Member Avatar for kshahnazari

Well if you use `getline()` it will read in everything in the file until it reaches a newline. You can read about it [here](http://www.cplusplus.com/reference/string/getline/).

Member Avatar for deceptikon
0
113
Member Avatar for marnun

The way you have your code now if either stream fails it will end the loop. The problem is you arent doing anything after that. I would do this a little differently. Look at how this works. while(getline(firstFile, line1) && getline(secondFile, line2)) { thirdFile<< line1 << endl << line2 << …

Member Avatar for marnun
0
280
Member Avatar for restrictment
Member Avatar for mike_2000_17
0
144
Member Avatar for hasan101002
Member Avatar for hasan101002
0
405
Member Avatar for myk45

Well you could make a base class that has a generic function called `getList()` that would display the list. Then you could derive your differnt kinds of list from that base class. then the `foo()` function will get passed a pointer to the base class so it can except both …

Member Avatar for myk45
0
192
Member Avatar for Jbvo

Why are lines 15-17 inside your constructor? Your close bracket on line 18 should be on line 15.

Member Avatar for Jbvo
0
95
Member Avatar for new_developer
Member Avatar for ousaf

What kinda of file processing do you need to do? You might want to check [This](http://lmgtfy.com/?q=working+with+files+c%2B%2B) out.

Member Avatar for Prysm[VA]
0
205
Member Avatar for marnun

You are not reseting count anywhere. After line 16 put `count = 0;` and see what happenes.

Member Avatar for marnun
0
2K
Member Avatar for vmanes

I think I'll stick with the use of `c_str()` for the time being. Ill wait till c++0x becomes more widespread.

Member Avatar for NathanOliver
0
1K
Member Avatar for marnun
Member Avatar for AznWun

modify is a `char *` not a `string` therefore it does not have `rbegin()` or `rend()` member function. Do you have to work with a `char *` or can you use a `string`? If you have to use a `char *` then you need to know the legnth of the …

Member Avatar for ravenous
0
323
Member Avatar for darkeclipse8

I think the issue is comming from how you are sizing the vector. I think you should use this to define the size of the vector in your constructors. grid.resize(rows); for (int i = 0; i < rows; i++) { grid[i].resize(cols); }

Member Avatar for NathanOliver
0
409
Member Avatar for szejna
Member Avatar for szejna
0
266
Member Avatar for marnun

This was alread answered [here](http://www.daniweb.com/software-development/cpp/threads/386160/input-sorting-without-arrays-pointers-or-vectors#post1664744). It is a trick question.

Member Avatar for marnun
0
3K
Member Avatar for James19142

You say Heading is a QString. Why to you have the () after it? Is it a function that returns a QString? What happens if you do `QString = theArray[10].Heading()`?

Member Avatar for James19142
0
909
Member Avatar for SeePlusPlus2

I think you need to change line 15 to if ( i < 4 && myArray[i] == myArray[i+1]) The way you have it now the last time you go through the loop you are going past the end of the array and it will cause undefined behavior.

Member Avatar for SeePlusPlus2
0
183
Member Avatar for PrincessLyka

When you say it just stops does it lock up or does it display the value of b?

Member Avatar for deceptikon
0
126
Member Avatar for tayyabatiq
Member Avatar for Hey90

Have you checked output_file to see if it is opening the file. ou can put this in your code after you open the file to make sure it is really opening the file. if(output_file.fail()) cout << "The file could not be opened!\n";

Member Avatar for Hey90
0
251
Member Avatar for rodrigo.l.salazar.14

Your loop should look like this for(int i=0; i < 50; i++) { infile >> list[i]; cout << list[num]; } You also dont need to put it in a while loop if you know you are only going to read 50 records. If you dont know how many records you …

Member Avatar for rodrigo.l.salazar.14
0
161
Member Avatar for GolDRoger00

@AD strEmployeeCategor is an STL string not a char[]. I think the issue he is having is that he is trying to compare floats and he has one of those .00000000000001's hanging around.

Member Avatar for Ancient Dragon
0
127
Member Avatar for new_developer

It is a default parameter. If you do not send anything then it will default to zero but if you pass a value it will get the value passed. To pass the value you would need to have a child constructor like this. Child(int n) : Parent(n) { cout << …

Member Avatar for NathanOliver
0
342
Member Avatar for marius2010

well you need to use a loop and go from the next odd number greater than what you entered untill you find a number that is prime. bool prime = false; while(!prime) { // check if number is prime // if number is prime set prime to true // increment …

Member Avatar for Lucaci Andrew
0
192
Member Avatar for Jbvo

currently you are doing nothing with the vector you have in your function. since it is a local variable of the function it gets created and destrroyed everytime you call the function. If you want to get all of the words from a text file into a vector you can …

Member Avatar for Mephesh
0
155
Member Avatar for RonKevin
Member Avatar for Lucaci Andrew
0
147
Member Avatar for Carpetfizz

Well you can see if the line from the user contains the words open and door. Something like this if(userInput.find("open") && userInput.find("door")) // open door You can also get a little more complicated and make sure you find open before the word door.

Member Avatar for Carpetfizz
1
281
Member Avatar for pinaka

So what is your problem? From what I can see you dont define count in your strlength function. As far as I can remeber strings from the string type are not terminated with a `'\0'`. You can you the `size()` function to find the legnth of the string. You would …

Member Avatar for pinaka
0
182
Member Avatar for chris.vargas.773
Member Avatar for sabrimev

The error you are getting is saying that it can’t find an operator << that will take a vector. The vector class does not have built in stream operators so if you want to pass a vector to << than you need to write your own function to do that.

Member Avatar for sabrimev
0
169
Member Avatar for coroshea

Line 8 needs to match the first par of your for loop. The codition of the while loop needs to match the condidtion of the while loop. The very last line of the while loop needs to match the last part of the for loop. In you case you need …

Member Avatar for coroshea
0
211
Member Avatar for Sam_07

You are using a long int which has a max value of 2,147,483,647 so if you give it 5,744,074,063 it is going to wrap around. you can try using a long long which is 64 bits with a max value of 9,223,372,036,854,775,807

Member Avatar for NathanOliver
0
4K
Member Avatar for Growl

You can right your own pow function like this int power(int base, int exponent) { int result = base; for (int i = 1; i < exponent; i++) { result *= base; } return result; }

Member Avatar for NathanOliver
0
111
Member Avatar for Sasquadge
Member Avatar for Sasquadge
0
181
Member Avatar for schutzk21

Well you need to write a sort fuinction that will take an int array and sort in asscending order. You will need to repet this for decimal types and char types. Then you have to write the same sort function but change them from asecending to decending order. This will …

Member Avatar for Lucaci Andrew
0
201
Member Avatar for CodyM

I believe line 11 should be `p = p->link` and you can get rid of lines 4,5 and 12.

Member Avatar for NathanOliver
0
110
Member Avatar for mc3330418

You can use a loop but you need to store your scores in an [array](http://www.cplusplus.com/doc/tutorial/arrays/)

Member Avatar for mc3330418
0
150
Member Avatar for soujanya.bhat.184

As you have with your first example you declared 2 Window pointers and made one a Window and one a CommandButton. In your second example you had to have a Window and a CommandButton pointer. So having virtuall functions allow you to cast a derived object to the base and …

Member Avatar for Agni
1
199
Member Avatar for slygoth

int * Foo() { int * returnValues = new int[what ever size array you want here] // do stuff return returnValues; } // in main int * getReturnValues = Foo();

Member Avatar for Despairy
0
204
Member Avatar for jamd200

I found [URL="http://podofo.sourceforge.net/about.html"]this[/URL] while googeling. Might be something worth looking into

Member Avatar for zarfishan
0
2K
Member Avatar for Growl

So what is the problem you are having? If you want to generate all numbers less than n that equall 2^k-1 than you can do this for(int k = 0; k < (int)pow((double)2,k) - 1; k++ { // check if (int)pow((double)2,k) - 1 is prime }

Member Avatar for NathanOliver
0
124
Member Avatar for az-mi51

When you say the outside numbers you mean the numbers that are going to be multiplied together like a standard multiplication table?

Member Avatar for faroukmuhammad
0
122
Member Avatar for ikra61893

First things first. when you want to check if more than one thing is equall to the same value you have to do if(x <= 100 && y <= 100 && z <= 100) Secondly you can only fave one return value in a function. You can not return three …

Member Avatar for ikra61893
0
156
Member Avatar for TexasJr

In your system you could have a CR/LF for \n. This would mean you have two charecters to get rid of. An easy way to get arroung this is to take in everything as a string and then convert the string to get what you need. If you want to …

Member Avatar for TexasJr
0
126
Member Avatar for az-mi51

You need to define the size of the 2d array. The way you have it now it should the compiler will make it 2X12 whn you actually need it to be 12X12. I would change it to `int prodouct[ROW_SIZE][COLUMN_SIZE];`

Member Avatar for az-mi51
0
225
Member Avatar for Starship12

We are not going to do your homework for you. If you have some code that you would like us to check post it. If all you are going to do is beg for code than you should realize that you are violating the member’s rules.

Member Avatar for NathanOliver
0
121
Member Avatar for danibecse

Static functions are generally used when you have static data members in a class and you want to be able to acess the static data. You have to have a satic function to acess static data since it is seperate from the objects of that class.

Member Avatar for NathanOliver
0
219

The End.