View Full Version : learning C++
doc_bean
10-16-2006, 16:06
Yes, another year, another programming language it seems. Last year it was Java, this year it will be C++. I don't think I'm going to do anything fancy with it. Luckily I just need it to control a robot (read data, apply filter, send data, etc.) , so it shouldn't be too hard...
Currently, I'm looking for 3 things:
*A (the ?) compiler, and whatever else I need to turn code into a working program.
*An easy, to the point guide about C++. Since I'll probably focus on procedural programming, it doesn't need to be complete. I'm mostly interested in the syntax, basic structures and basic commands right now. Someone already recommended C++ for dummies to me, unfortunately my library doesn't have it so I'll have to check it out in a store. Anyone have any experience with this book ? Any other recommendations ?
*A development platform. I used Eclipse for Java, but am unsure of how good its C++ support is. Plus it's sloooooow. Anyone know of a decent one for C++ ?
*A development platform. I used Eclipse for Java, but am unsure of how good its C++ support is. Plus it's sloooooow. Anyone know of a decent one for C++ ?
Microsoft Visual Studio comes with Visual C++.I dont know if it good or not.
Regards
Caius
doc_bean
10-16-2006, 16:38
I need to program for Linux, so I'm going to avoid Microsoft products.
You may want to learn C first, unless you can already code in C?
doc_bean
10-16-2006, 18:09
Nope, I know Java and Pascal (although that's been a while). But I need to use C++, and I really don't have the time for indepth studies into C/C++.
I suspect most of the code I will be writing will be C style (the non OOP component of C).
Blodrast
10-16-2006, 18:41
1. Since this is academia, my guess is just gcc. It will be available on whatever platform you will be writing your code. Hell, it runs on anything short of microwave ovens, and I think even that's under development.
If you wanna code at home, and don't have/don't wanna install linux, then just install cygwin, and then install gcc under it.
(note: in case you install a different compiler/gcc version at home, always make sure you test your code on the school compiler - this is always a problem with the students here: "but I tested this at home on <whatever other platform/compiler> and it was workiiiiing!")
2. http://www.cppreference.com/ is a pretty good one, assuming you always have net access.
As for books, whatever they recommended as the textbook; although, to be honest, I haven't touched a book in .... ages. I find that online help and reference sites are more useful/helpful than books, but, ofc, YMMV.
3. well, I dunno, depends what you'll have installed on your lab machines.
I recommend vi/emacs. :2thumbsup:
Wow, C++ in this time and age...
It's been what, 7 years since I progged in C++?
I used the Borland C++ compilator and editor to write my console programs. I can't even remember the version although I think it was version 5 in the end.
For books we used a Norwegian book called "C++ and object oriented programming".
I have another book which is quite old called “Standard C++” which is a book in the yellow Bible series (Stevens & Walnum)
doc_bean
10-17-2006, 14:33
Wow, C++ in this time and age...
Oh ? What's hip with the kids these days then ?
Blodrast
10-17-2006, 19:29
I guess that would be C# or Python, depending on what your targets are...
But I'm old-fashioned, and I don't keep up to date with trendy stuff, I guess...
Oh ? What's hip with the kids these days then ?
C# here...
If you know it well you are guarantied a job (today that is, tomorrow is another day)
The_Doctor
10-18-2006, 12:05
Is there much difference between C++ and C#?
Is there much difference between C++ and C#?
It would be a long post if I should make the comparison myself. In stead I'll provide a link: Similarities and Difference between C# and C++ (http://www.csharphelp.com/archives/archive138.html)
The_Doctor
10-18-2006, 14:24
It would be a long post if I should make the comparison myself. In stead I'll provide a link: Similarities and Difference between C# and C++
Thanks.:2thumbsup:
_Martyr_
10-21-2006, 14:30
Funny how these things go... till now ive been a C++ programmer, now I have to change over to Java. Want to swap brains? :laugh4:
doc_bean
02-26-2007, 17:23
Maybe someone can help me with this one. I need to have two linked `arrays`(I`m actually using a special vector class) I need to sort one and remember where each value went (in other words, if the elements would be numbered like 1-10, I`d need a new row like 9 5 6 ... telling me where they went after sorting).
I`ve been able to implement a difficult solution to this problem but something tells me it should be easy...
EDIT: anyone know how I can sort objects ?
Blodrast
02-26-2007, 22:37
I'm utterly confused as to what you're trying to do. Why do you need two arrays ? Or you don't need them, but in your solution you felt you needed both of them ?
Is it that you have the actual data in one, and their positions in the other one ? Is that the requirement of the problem, or is there any other reason why you want the two arrays ?
Re sorting objects, normally, I guess you'd just overload a generic sort function, with a separate function for each of your object types.
edit: a "simple" method, IF I understand correctly what you want (which I wouldn't bet money on), would be:
1st array holds the elements you want sorted, 2nd array holds their positions (or pointers to them, or whatever you want).
Whatever operation you do on the first array, do on the second array, as well. So, for example, let's say element 1 in array1 goes to position 3. Then you write 3 in element 1 in your second array.
Or, say your sorting algorithm exchanges elements 3 and 6 in array1. Exchange the values of elements 3 and 6 from the second array.
Does this make sense ?
doc_bean
02-27-2007, 09:02
I'm utterly confused as to what you're trying to do. Why do you need two arrays ? Or you don't need them, but in your solution you felt you needed both of them ?
Is it that you have the actual data in one, and their positions in the other one ? Is that the requirement of the problem, or is there any other reason why you want the two arrays ?
Re sorting objects, normally, I guess you'd just overload a generic sort function, with a separate function for each of your object types.
edit: a "simple" method, IF I understand correctly what you want (which I wouldn't bet money on), would be:
1st array holds the elements you want sorted, 2nd array holds their positions (or pointers to them, or whatever you want).
Whatever operation you do on the first array, do on the second array, as well. So, for example, let's say element 1 in array1 goes to position 3. Then you write 3 in element 1 in your second array.
Or, say your sorting algorithm exchanges elements 3 and 6 in array1. Exchange the values of elements 3 and 6 from the second array.
Does this make sense ?
I think you got it, sorry if I wasn`t clear, it had been a long day :embarassed:
Anyway someone gave me a piece of code that should solve the trick, the idea was indeed to just overload a basic sort functon and write similar code that does the same operation on 2 vectors, I had thought there would have been an easier way. Don`t waste too much time looking for the easy way out I guess :shame:
Blodrast
02-27-2007, 23:19
On the contrary, you should be glad you did it the right, and elegant, way.:2thumbsup:
vBulletin® v3.7.1, Copyright ©2000-2025, Jelsoft Enterprises Ltd.