• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

Practical way to quickly develop C++ skills

Joined
12/3/09
Messages
36
Points
18
Hi, I am looking for a practical way to develop genuine C++ skills. How can I possibly do this on my own? Get a book from the master reading list, and read all pages and do all examples? Pls ,any idea, plan, agenda, schedule are appreciated.

I've just done below so I am good to go:
1. installed a dedicated VM for coding environment running windows xp.
2. installed VC++ express and complied boost and quantlib.
3. installed matlab, python, R, excel(and all related adding),erlang,perl,mySQL,IB API,Eclipse for J2EE.
4. I have 3 hours everyday dedicated to C++.

The reason I made this post is that I feel hopeless to master C++ quickly by studying the book "Absolute C++" , I really do not think the example on it can make me a master, and breadth of topics are so large, I forget things I studied few days ago, and can only remember principles. Is there any community that I can join to do a C++ project and learning by contributing in real work.
 
c++, java, python.. all are merely programming languages. programming languages follow a set of grammar and rules to run your programs. so i suggest u learn programming by starting in java or php. Learning c++ is like learning to run first before walking. I started with C.

C++ can run in linux and eclipse, don't have to use VC or windows specifically. The advantage C++ has over Java, Cobal, and other is that it is much more object oriented and have better memory access in trading systems, commonly used in high frequency trading.

Start off by solving a simple question. It can be as easy as a simple, one-line command prompt output. If you can't do this in C++, at least try in Java first. Once you're comfortable with input/output, variable management and for loops, you're good to go playing with quantitative data and implement your own models!

pick up some tutorials on google, they're the best way to get started.
 
The reason I made this post is that I feel hopeless to master C++ quickly by studying the book "Absolute C++" , I really do not think the example on it can make me a master, and breadth of topics are so large, I forget things I studied few days ago, and can only remember principles. Is there any community that I can join to do a C++ project and learning by contributing in real work.
Why don't you just start with the level 1 and 2 of our C++ Programming for Financial Engineeering online course. The first two levels are open to the public where you can watch video lectures, do the HW, take the quizzes, participate on the forum.
Doing it with other people is the best way to learn instead of reading book by yourself without anyone to point out your mistakes.
See more info here https://www.quantnet.com/forum/threads/faq-c-for-financial-engineering-online-course.7376/
 
pew pew thanks, I forgot to mention that I am not a rookie in programming. I possess basic knowledge of C++ from variables, loop, class, contruct, but before advanced topic such as STL. I used to do numerical analysis in matlab, statistics in R. What I am looking for is a efficient way to get comfortable with everything in C++ and how to master advanced topics. I think this comes with practices and corrections. But I really do not know a way to do it. If you gave me project A, I finished it on my way. Who is gonna tell me whether my code is good or not.
 
write code. A student made a suggestion to basically try to solve HS Contest programs. You can also try to solve the Informatic Olympiad problems... read Scott Meyer's books. Learn the new C++ standard. The are new syntax constructs to make your life easier. Read other people's code.
 
I was going to suggest Project Euler as well.

Generally what you need is real projects.
 
Why don't you just start with the level 1 and 2 of our C++ Programming for Financial Engineeering online course. The first two levels are open to the public where you can watch video lectures, do the HW, take the quizzes, participate on the forum.
Doing it with other people is the best way to learn instead of reading book by yourself without anyone to point out your mistakes.
See more info here https://www.quantnet.com/forum/threads/faq-c-for-financial-engineering-online-course.7376/

See, if this course was free ala Udacity/Coursera, I would *so* do this one. Unfortunately, I'm flat broke (all the $ I made from Chicago went to student loans after I got laid off, and my consulting jobs have paid peanuts since).
 
Thanks for quick reply guys. I can feel passion from all of you.
Just solved my problem1 from euler project.

My code looks ugly, but it did the work, I used type conversion to determine integer, I think this is what this project can brought me, you learn different ways to solve problems, this really do master a specific knowledge.

C++:
#include <iostream>
using namespace std;
 
void main()
{
    double a;
    int b=0;
    int c=0;
    int x=0;
    for (a=1;a<1000;a++)
    {
        b=a/3;
        c=a/5;
        if (a/3==b || a/5==c)
        {
            x=x+a;
        }
    }
    cout<<x<<endl;
    system("pause");
}
 
Your formatting isn't quite working.

Be sure to read other peoples' solutions as well, you really get an appreciation for the diversity of programming languages and their various degrees of power. I found some of the Haskell solutions particularly elegant.

Edit: looks right now.
 
Thanks for quick reply guys. I can feel passion from all of you.
Just solved my problem1 from euler project.

My code looks ugly, but it did the work, I used type conversion to determine integer, I think this is what this project can brought me, you learn different ways to solve problems, this really do master a specific knowledge.

C++:
#include <iostream>
using namespace std;
 
void main()
{
    double a;
    int b=0;
    int c=0;
    int x=0;
    for (a=1;a<1000;a++)
    {
        b=a/3;
        c=a/5;
        if (a/3==b || a/5==c)
        {
            x=x+a;
        }
    }
    cout<<x<<endl;
    system("pause");
}

I've never trusted comparing double and int like that. I'm always afraid that there will be some rounding error. Maybe I've been using excel for too long, but I see that come up all the time.
 
You need to refresh your C++. Those are "int"s comparisons.

PS - Stop using Excel if you can :)

I would if I could, but alas it's the least bad spreadsheet out there, and I can't survive without spreadsheets.

My C++ may be rusty, but I don't think that code would work if it were converting a/3 to int (in the if statement). Doesn't it convert the values of b and c to double?
 
Ahh that's one of the beauties of C++ 2/3 is done using integer math...:devil:
 
My C++ may be rusty, but I don't think that code would work if it were converting a/3 to int (in the if statement). Doesn't it convert the values of b and c to double?

you are correct. I didn't see the double a at the top. ah... never assume!!!

However, conversion from int to a double will usually work up to a certain level (don't remember the number now but it's a big number).

Regarding this little piece of code, try to avoid mixed type arithmetic. It will make your code brittle.
 
It's always more fun, and easier to remain motivated, by writing simple games. Here's how I started off:

Level 1. Start off writing a tile game (I call it tile but think its more commonly known as Mosiac). Write a program where you can manipulate the empty cell on the display below until the numbers are all aligned. This exercise enables you to learn logical constructs and simple i/o.

| 2 | 3 | 5 |
| 1 | 4 | 6 |
| * | 8 | 7 |

Plot your next move (w = up, s = down, a = left, d = right):

Level 2. Write a program to solve Sudoku puzzles. It must be able to read a CSV file containing an initial Sudoku board, represent the Sudoku board using a class instance containing cells, rows, etc, then use breadth-first search or some other strategy to "play" the board and determine and print out the solution to the puzzle. This exercise enables you to learn file i/o and basic OOP design principles/patterns and also the concept of constraint-programming. You can throw in pointers as well to optimize your program.

Level 3. At this stage you should be able to write a program to model any puzzle game you like. I'm currently mid-way through my 2nd semester of the MQF program and so don't really have the time, but I'm planning to write a program to help me choose optimal next-steps for the iPad game called TripleTown.

Level 4. And now for the most interesting game of all: create a demo/paper account for a brokerage with a C++ API (eg IB), write a program to connect to the API, and start trading :)
 
you are correct. I didn't see the double a at the top. ah... never assume!!!

However, conversion from int to a double will usually work up to a certain level (don't remember the number now but it's a big number).

Regarding this little piece of code, try to avoid mixed type arithmetic. It will make your code brittle.


Hi, Thanks for bring this up. I did not pay attention to this issue, and I was just assumed it converts double to integer by instinct.

I found the following quote from web, I think I was correct, It did convert double to int, not the other way around.


http://www.informit.com/articles/article.aspx?p=352857&seqNum=4



Conversion on Assignment

C++ is fairly liberal in allowing you to assign a numeric value of one type to a variable of another type. Whenever you do so, the value is converted to the type of the receiving variable. For example, suppose so_long is type long, thirty is type short, and you have the following statement in a program:
so_long = thirty; // assigning a short to a long
The program takes the value of thirty (typically a 16-bit value) and expands it to a longvalue (typically a 32-bit value) upon making the assignment. Note that the expansion creates a new value to place into so_long; the contents of thirty are unaltered.
 
Hi, Thanks for bring this up. I did not pay attention to this issue, and I was just assumed it converts double to integer by instinct.

I found the following quote from web, I think I was correct, It did convert double to int, not the other way around.

The assignment is fine. It's the comparison in the if statement that's the issue. You have a/3 == b. The value of b will be converted to a double, which is fine since it's not very large. However, it's not always safe to assume that a whole number stored as a double will give you the number you expect. For example, try this code:

C++:
#include <iostream>
using namespace std;
 
int main ()
{
    int i;
    double j = 0;
 
    for (i = 0; i < 10; i++) {
        j += 0.1;
    }
 
    cout << (j == 1) << endl;
 
    return 0;
}

It will output 0.
 
Back
Top