Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,471 members, 7,816,118 topics. Date: Friday, 03 May 2024 at 05:26 AM

Want To Learn To Program In A New Language? - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Want To Learn To Program In A New Language? (1581 Views)

Learning To Program With Java by the Fulaman / Want To Program PIC Microcontroller In Assembly Language?[enter HERE] / Halide: A New Language For Image Processing And Computational Photography (2) (3) (4)

(1) (Reply) (Go Down)

Want To Learn To Program In A New Language? by ektbear: 4:40am On Apr 14, 2013
So I decided a few days ago that I wanted to improve my C++ skills (specifically C++11). I found this wonderful website Projecteuler.net that has programming puzzles of a mathematical bent. Since I hate the programming assignments in most textbooks (I find writing tic-tac-toe games and sh1t like that tedious/boring) but really enjoy the small puzzles on this site.

Anyway, I'm really happy with this site so far, and just wanted to recommend it to others.

2 Likes

Re: Want To Learn To Program In A New Language? by Nobody: 3:03pm On Apr 14, 2013
Thx for the sharing, amma check it up now
Re: Want To Learn To Program In A New Language? by ektbear: 10:00am On Apr 15, 2013
I'm doing the problems in decreasing order of difficulty (where difficulty is measured by how many people have done the problems already).

So...as much as I used to think C++ was a tedious/annoying language before, now I'm starting to like it better. The auto for loop allows you to iterate over a list like in Python, while the transform() function in the <algorithm> library is the equivalent of a map/list comprehension like in Python (well, nearly).

The only thing I'm really missing at this point from Python is pretty printing...super annoying how there is no pre-built way to convert vector to string for print purposes sad

I could of course write my own code to do this (and have done so), but would prefer if there was some prebuilt library I could just install/include.

Anyways, I've done 11 problems so far: http://grab.by/lDDO

Some sort of bug in my solution to "Largest Product in a Grid." Well, either a bug or me misunderstanding the problem statement. Will fix tomorrow.
Re: Want To Learn To Program In A New Language? by lordZOUGA(m): 10:40am On Apr 15, 2013
ekt_bear: I'm doing the problems in decreasing order of difficulty (where difficulty is measured by how many people have done the problems already).

So...as much as I used to think C++ was a tedious/annoying language before, now I'm starting to like it better. The auto for loop allows you to iterate over a list like in Python, while the transform() function in the <algorithm> library is the equivalent of a map/list comprehension like in Python (well, nearly).

The only thing I'm really missing at this point from Python is pretty printing...super annoying how there is no pre-built way to convert vector to string for print purposes sad

I could of course write my own code to do this (and have done so), but would prefer if there was some prebuilt library I could just install/include.

Anyways, I've done 11 problems so far: http://grab.by/lDDO

Some sort of bug in my solution to "Largest Product in a Grid." Well, either a bug or me misunderstanding the problem statement. Will fix tomorrow.
convert vector to string..? you know that the string class is a subclass of vector
Re: Want To Learn To Program In A New Language? by ektbear: 11:08am On Apr 15, 2013
No I mean, rather than me writing:

string vec_to_string(vector<int> foo){
stringstream temp;
for (auto x: foo){
temp << x << " ";
}
return temp.str();
}

I just wish there was a header I could include that came by default in most Unix systems (or is easily installable, like Boost) that would do this.
Re: Want To Learn To Program In A New Language? by ektbear: 11:09am On Apr 15, 2013
Also, it doesn't appear that string is a subclass of vector.
Re: Want To Learn To Program In A New Language? by lordZOUGA(m): 12:50pm On Apr 15, 2013
ekt_bear: Also, it doesn't appear that string is a subclass of vector.
not exactly a subclass... string is defined as a typedef of a container type.. something like this :
namespace std {
typedef basic_string <char> string
}
where basic_string<T > is a template subclass of vector.
that's why you can use iterator on a string and if you check the string class methods, you will see the push_back()
Re: Want To Learn To Program In A New Language? by lordZOUGA(m): 1:02pm On Apr 15, 2013
ekt_bear: No I mean, rather than me writing:

string vec_to_string(vector<int> foo){
stringstream temp;
for (auto x: foo){
temp << x << " ";
}
return temp.str();
}

I just wish there was a header I could include that came by default in most Unix systems (or is easily installable, like Boost) that would do this.
you can use for_each() for this type of iteration, it takes a function pointer and a container and applies the function to each object in the container but since you said you are printing, why do you have to convert an int to a string before printing when you can just send it directly to stdout?
Re: Want To Learn To Program In A New Language? by ektbear: 5:19am On May 10, 2013
Two updates:

1. I've only done 15 problems. I'd like to at least get to 25 before the end of the month, 100 before the new year.
2. Switching to doing the problems in Python.
Re: Want To Learn To Program In A New Language? by ektbear: 1:46am On May 17, 2013
Just completed my 25th problem:

Congratulations, the answer you gave to problem 24 is correct.

You are the 47380th person to have solved this problem.

Nice work, ekt_bear, you've just advanced to Level 1.
51004 members (16.54%) have made it this far.

You have earned 1 new award:

The Journey Begins: Progress to Level 1 by solving twenty-five problems
Re: Want To Learn To Program In A New Language? by Nobody: 3:41pm On May 17, 2013
Just started using NodeJS to solve it, till i switch to Python.
Re: Want To Learn To Program In A New Language? by ektbear: 8:21am On May 19, 2013
Heh Node is hot right now, but I hate javascript. So i've not learned it.
Re: Want To Learn To Program In A New Language? by madelinekim(m): 11:22am On May 21, 2013
If you want to learn new programming language then you have to make your base or fundamental of programming clear which is the first step to move ahead. After making the base clear you can move high level language like .NET, JAVA, PHP etc whatever you want.
Re: Want To Learn To Program In A New Language? by Kobojunkie: 11:43pm On May 26, 2013
lordZOUGA:
convert vector to string..? you know that the string class is a subclass of vector

A String is not a subclass of a Vector class . .. not in C, C++, Java, .NET, or any of the other languages I know. You probably meant something else.
Re: Want To Learn To Program In A New Language? by Kobojunkie: 11:46pm On May 26, 2013
madelinekim: If you want to learn new programming language then you have to make your base or fundamental of programming clear which is the first step to move ahead. After making the base clear you can move high level language like .NET, JAVA, PHP etc whatever you want.

I disagree! You can start learning with any language out there, whether it be a high-level language, a pure language, hybrid or even low level languages like assembly and machine code. The main is to understand the basics of programming in general, and I am talking memory organization, control structures, procedures calls, types etc. Then you can learn basically any programming language in the world, in a matter of days, even.
Re: Want To Learn To Program In A New Language? by lordZOUGA(m): 11:12pm On May 27, 2013
Kobojunkie:

A String is not a subclass of a Vector class . .. not in C, C++, Java, .NET, or any of the other languages I know. You probably meant something else.
i explained what I meant below. a string is a container type in C++
lordZOUGA:
not exactly a subclass... string is defined as a typedef of a container type.. something like this :
namespace std {
typedef basic_string <char> string
}
where basic_string<T > is a template subclass of vector.
that's why you can use iterator on a string and if you check the string class methods, you will see the push_back()

(1) (Reply)

There Are Only Three Black People In The Silicon Valley TV Show. / Top 10 Best Websites To Learn Programming / I Need A Free Working Vpn App

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 27
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.