Need help with something.

Good day everyone, well I started to learn c++ not long ago.
Need to do one thing but I am not able to. Even people I learn with couldnt do it.

So here is the thing. I had to make a txt file where there is a list about houses. Four types info in columns. Where they are, type, size and price.

So I need it to show info than let user to choose which column he wants. Price,size or location. Sort it in order and then put it in txt file. Every column needs to be put in another txt file.

I needs to be done using map. Making container puting info there there than taking out what you need.

Help would be great. Cant do it.
So here is the thing. I had to make a txt file where there is a list about houses. Four types info in columns. Where they are, type, size and price.
Show example of file. How columns are separated? Are there whitespaces in location?

So I need it to show info than let user to choose which column he wants. Price,size or location. Sort it in order and then put it in txt file. Every column needs to be put in another txt file.
So you need 4 txt files? One with location, one with price, one with size and one with type?

I needs to be done using map
Map is not adequate container choice for this.
Three txt files. My list starts with location,type,size and price. I need to do this with map unfortunatly :/
I only need size,price and location. House type is not needed.

http://speedy.sh/CGTRg/sarasas.txt
Last edited on
Is location always 2 words? Can there be number in location? Are loaction/size/price separated by tabs or spaces?
No the first column is location and then its the type. They are just in lithuanian language. No there are no numbers in location. By spaces.
Here is the code which reads content of the file into vector and then sorts it by chosen method.
http://pastebin.com/uFEfsPqn
How is it looks: http://puu.sh/9gczr/2be103dcaa.png
What is missing: output to files (simple enough to not include it here) and map. I could use set here, but map? I could store comparator functions in map<int, function<....>> but It is unnesesary.
Thanks, but when i compile it shows a lot of mistakes and cant be run.
What compiler do you use? You have probably have C++11 support turned off
Last edited on
Dev-c++4.9.9.2
It is extremely outdated, contains numerous bugs and does not support newer features of C++. I would suggest to update to the Orwell Dev-C++ 5.6.3
Same thing.
go to: Tools >> Compiler Options >> (select your compiler) >> Settings >> Code Generation >> (set 'Language standard' to a C++11 option)
Ok ty a lot. Now it works. Just need to output it to txt files.
Ty again will try.
Topic archived. No new replies allowed.