1,426 Posted Topics

Member Avatar for nhrnjic6

Why on earth would you return a string from this function and not take strings? A `char *` can be converted to a string so you should use strings. Does this code even compile? I'm not sure what compiler ou are using but line 16 should not compile. I'll help …

Member Avatar for vijayan121
0
234
Member Avatar for HuePig

Well you can have the StoneAdventure class hold a vector of rooms and then you can declare room to be a friend of StoneAdventure.

Member Avatar for HuePig
0
205
Member Avatar for Pineas
Member Avatar for rehan_5

@ melissad - What you poseted was not c call at all. `fstream` is from the C++ STL. Not sure if you noticed but your code will run forever or throw an exception for reading outside the bounds of the file or array. There is an error with the inner …

Member Avatar for sanjulovers
0
4K
Member Avatar for Tycellent

Is it not working? It should work but I see you have the code commented out. Why is that? [Here](http://www.cplusplus.com/reference/algorithm/sort/) is a good reference for using sort.

Member Avatar for Tycellent
1
452
Member Avatar for nhrnjic6
Member Avatar for nhrnjic6
0
303
Member Avatar for Ivzirnalsradeys

That's not going to happen. This is not a website where you post your problem and you get an answer. This is a place where you come to with questions about an answer and we will help you with it. You get what you put in. Putting in nothing gets …

Member Avatar for rubberman
-2
236
Member Avatar for er.akshayk

There is no standard way in c++ to have an `*` replace a character while typing.

Member Avatar for rubberman
0
152
Member Avatar for Cave_1

What compiler are you using? MSVS 2013 does not have an issue with it. Also if you want to intialize number with 4 using braces you would use `int number{4};`

Member Avatar for Cave_1
0
367
Member Avatar for andrew mendonca
Member Avatar for david muchuku
Member Avatar for Joemeister

You have: bool Expression::IsOperator(char C) { if(C == '+' || C == '-' || C == '*' || C == '/' || C == 'sqrt' || C == 'log' || C == 'abs' || C == '~') { return true; } else { return false; } } Which makes no …

Member Avatar for マーズ maazu
0
921
Member Avatar for coxxie

That means the the Polynomial class is going to have an array of terms the represent the polynomial.

Member Avatar for NathanOliver
0
3K
Member Avatar for Joemeister

Whats is `sqrt` in `modifiedExpr.replace(modifiedExpr.find(sqrt),sqrt.length(),"#");`? Is it a string? You should be able to do: string sqrt = "sqrt"; size_t pos = 0; while((pos = modifiedExpr.find(sqrt, pos)) != std::string::npos) { modifiedExpr.replace(pos, sqrt.size(), "#") }

Member Avatar for L7Sqr
0
198
Member Avatar for Joemeister

`modifiedExpr = originalExpr;` needs to be moved outside the loop. The way you have it now is every time the loop is executed `modifiedExpr` becomes the original again erasing what you just did.

Member Avatar for iamthwee
0
165
Member Avatar for DavidB

When I read an unknown amount of data from a file I will use the following std::vector<int> data; ifstream fin("sampleData.txt"); int temp; // used to store the data from the file temporarily //use >> operator to control the loop so you end on the last good read while (fin >> …

Member Avatar for DavidB
0
3K
Member Avatar for Joemeister

I take you have something like `"x + 5"` and you want a function that searches the expression for the variable and replaces it with a number. To do that you can use this: // make var_ a string to handle variables like "xx", "someval" instantiateVariable(string startingExpr, string var_, int …

Member Avatar for iamthwee
0
298
Member Avatar for rela

Well if you have never used C++ you really should learn how to use it before you try to use it. Otherwise how do you know how to start coding the project. Have you programmed in any other languages? What is the project that you need to get done? Does …

Member Avatar for NathanOliver
0
193
Member Avatar for aluhnev

Go to Project -> Add Class. That will create a new class and bring up the class wizzard.

Member Avatar for NathanOliver
0
225
Member Avatar for Jsplinter

Well `<<` is the shift bits to the left operator. Since the default value for `FOO_ENUM` is 0 you get: unsigned char sideFilter1 = 1 << FOO_ENUM; =unsigned char sideFilter1 = 1 << 0; =unsigned char sideFilter1 = 1; since 1 left shift 0 is still 1. Line 4 is …

Member Avatar for NathanOliver
0
184
Member Avatar for Katangka

What kind of project are you using? Is it a standard win32 console app or are you using something differently?

Member Avatar for misi
1
10K
Member Avatar for Otani

Are you trying to enter a name like "Nathan Oliver"? if so you need to use [getline()](http://www.cplusplus.com/reference/string/string/getline/) and not [>>](http://www.cplusplus.com/reference/istream/istream/operator%3E%3E/). Don't forget to [flush the input stream](http://www.daniweb.com/software-development/cpp/threads/90228/flushing-the-input-stream) when mixing `getline()` and `>>`

Member Avatar for Otani
0
783
Member Avatar for patrik666assassin

Line 6: should be using a string not an int. `string nap;` Line 10: get rid of the string decleration. `if (nap == "hétfő")` That should clear up some of your errors.

Member Avatar for patrik666assassin
0
144
Member Avatar for nibiruisaplanet

Dido. C++ support so many different programing paradimes that can be related to so many different languages.

Member Avatar for melissad
0
300
Member Avatar for Jjajangmyeon

`string` and `stringstream` need to be qualified with `std::` or you need to put `using namespace std;` in your code after you includes.

Member Avatar for David W
0
237
Member Avatar for Joemeister

The way I have done it is like: size_t pos = 0; int counter = 0; // loop untill substrng is not found. while ((pos = strng.find(subStrng, pos)) != std::string::npos) { counter++; pos++; // increment pos so we dont duplicate the last search. } I am writing this from memory …

Member Avatar for Joemeister
0
2K
Member Avatar for aluhnev

[Here you go](http://stackoverflow.com/questions/895827/what-is-the-difference-between-tmain-and-main-in-c). personally unless I need or want to support command line arguments I just use `int main()`

Member Avatar for NathanOliver
0
353
Member Avatar for aluhnev
Member Avatar for TommyTee
Member Avatar for new_developer

Line 35 should use rowSize not colSize. This is because you are stepping through each row and deleting all of the columns.

Member Avatar for new_developer
0
254
Member Avatar for nathan.pavlovsky

I bet you need to clear the stream after the first while loop. Add `cin.clear()` in between the two while loops.

Member Avatar for nathan.pavlovsky
0
4K
Member Avatar for sohaib.danish.31

I would suggest that when the program starts you read in all of the data in the file and load it into an collection of "Movie Records". Then you can search that collection for the records you want.

Member Avatar for David W
0
514
Member Avatar for sunnyshahrukh

Generally speaking read and write are used to read and write binary data in files. Normally that goes hand in hand with [serialization](http://www.parashift.com/c++-faq/serialization.html).

Member Avatar for NathanOliver
0
83
Member Avatar for alysha.recore

Something like this would work vector<string> doc; vector<string> skipWords; // fill doc and skipWords from there files. When doing so convert each word to lower case. Remove any puctuation as well. //c++11 for(auto i : skipWords) doc.erase(remove(doc.begin(), doc.end(), i), vec.end());

Member Avatar for NathanOliver
0
169
Member Avatar for daniela.valkanova

As an FYI prerequisite programing classes are very important. Everything you do in higher level programing classes builds off of them.

Member Avatar for daniela.valkanova
0
274
Member Avatar for can-mohan

Change `props.emplace(std::pair<string,string>(tokena,tokenb));` to `props.insert(std::pair<string,string>(tokena,tokenb));`

Member Avatar for NathanOliver
0
231
Member Avatar for nathan.pavlovsky

Depending on the compiler you are using you might have to have everything in the header file instead of splitting it up like a normal class. I would put everything into the header file and see if that fixes the error. Also on line 15 in the cpp file you …

Member Avatar for mike_2000_17
0
8K
Member Avatar for davin_six
Member Avatar for nhrnjic6

Line 6 in you .cpp is `Nvector::Nvector(int Size) : velicina(Size);` it should be `Nvector::Nvector(int Size) : velicina(Size)`

Member Avatar for nhrnjic6
0
302
Member Avatar for cambalinho

No doing a print screen will remove the mouse icon. You could always draw on the picture though to show where the mouse was when you took the print screen. I do agree with triumphost that you really need to post a picture of what is happening.

Member Avatar for cambalinho
0
6K
Member Avatar for rela

If the files were not part of a previous project then you need to create a new blank project and then add the files to it.

Member Avatar for NathanOliver
0
706
Member Avatar for yazici.batuhan

It looks like that is how your instructor wants this done. Why he would want it like this I have no idea. IMHO he should be cited for endangering the education of a student. You could do this with a class but since you functions need to have access to …

Member Avatar for Moschops
0
324
Member Avatar for davecoventry

Why not use an enum class? In C++ it is possible to create real enum types that are neither implicitly convertible to int and that neither have enumerator values of type int, but of the enum type itself, thus preserving type safety. They are declared with enum class (or enum …

Member Avatar for NathanOliver
0
304
Member Avatar for Daneos

Do you actuall have a slot column in the database? if so you can use select min(slot) from inventory where item_id is null I'm not quite sure if that is correct for MySQl since I use Oracle PL/SQL but that should be the gist of it.

Member Avatar for NathanOliver
0
351
Member Avatar for daniela.valkanova

the OP doesnt have any code to pause between the output and the window closing so I would guess that was the issue.

Member Avatar for NathanOliver
0
1K
Member Avatar for nathan.pavlovsky

Since you are dealing with strings shouldn't `ostream_iterator<int> output(cout," ");` be `ostream_iterator<string> output(cout," ");`?

Member Avatar for nathan.pavlovsky
0
2K
Member Avatar for Fazelessmetal
Member Avatar for okeidowu

You can use [Code::Blocks](http://www.codeblocks.org/), [Visual Studio Express](http://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx) or a host of [others](http://lmgtfy.com/?q=free+c%2B%2B+compilers).

Member Avatar for NathanOliver
0
49
Member Avatar for messr135
Member Avatar for Yogesh_9

Don't use that code. That code is terrible. What are you trying to do? Oh yeah did I mention DON'T USE THAT CODE.

Member Avatar for mike_2000_17
0
193

The End.