Making the leap to C++

c

#1

After dabbling in a free course on Data Structures I’ve hit the C++ wall, which the course assumes one is comfortable with. It’s let us use Python up to a point, but now it is immersing in C++. To play along with this I’ve decided to cross that bridge into C, a language I’ve never really felt myself up to the task. Java is in that group, as well. Apart from the course here, I have zero Java background.

It’s nice to know that JS, PHP, Python and Ruby are closely connected to C++ (and Java), but not knowing C is something I can no longer avoid. It’s time to face it, and be glad that I know what I know going in. I can understand the discussions, if nothing more.

>>> harry = int()
>>> lloyd = int()
>>> dumb_and_dumber = bool(harry + lloyd)
>>> dumb_and_dumber
False

I got this by porting the C example to Python.

int harry;
int lloyd;
bool dumbAndDumber = (harry + lloyd)

Totally not possible in Java, but C++ (and obviously, Python) take it all in stride.

Anyway, long and short of this is what to install on my Windows 7 Professional 64-bit system so I can play along and get more hands on experience? Anybody got a reliable suggestion of code source, docs, etc. to guide me into the fire?


#2

Visual studio is a common choice for windows development of c/c++
MSDN C++ for visual studios
These two sties have some solid documentation
Reference #1
Reference #2

Since you have a background in programming and are wanting to jump into C++ I suggest exploring the STL and pointers right away. Getting used to pointers and stream operators might take some time.

You’re gonna have fun overloading operators and managing memory!


#3

Got it. Installed C++ and Python (but not .net, azure, etc.) Gonna take awhile to read and familiarize. Got Python up and running but not C. Should have done this years ago when I was a faster learner.

Just realized that Community 2015 is only a 30 day trial then I’ll have to create an account. Can’t see my wife wanting to spend money on something for me to just tinker around with. 'Fraid I don’t have the ambition I once had, nor the energy. Might have to retire this desire.


#4

eh pretty sure the word “community” is there to suggest that it is free of cost for individuals
in any case, you need a compiler, not a couple dozen microsoft tools
how about a couple dozen unix tools instead?
https://www.msys2.org/
there are installation instructions there, after which you run
$ pacman -S gcc
and then you should be good to go
you’ll find your home directory under C:/msys64/home/ or wherever you installed it, so you can save your cpp file there e.g.

// you'd put this in something like
// C:/msys64/home/wgillis/main.cpp

#include <iostream>

using namespace std;

int main() {
    cout << "Hello world!" << endl;
    return 0;
}

and then in your msys2 terminal you’d run:

$ g++ -std=c++11 -Wfatal-errors -Wall main.cpp
$ ./a.exe
Hello world!
$

(similarly you could install python with:
$ pacman -S python
)

to update all the things:
$ pacman -Syu


#5

Checking it out, now. Going to uninstall Visual Studio, first. Took over an hour to install last night. Should have waited…


#6

Uh, yeah, no clue what ms spends their installation time on. This is about 125MB total to download, which is extracted and written to disk, and that’s pretty much all that happens so it therefore takes less than 5 mins in all (I just tried it)


#7

Successful up to and including the Python install. Just what I needed and wanted. Thank you.


#8

And I don’t doubt that this is the better choice for an up-and-comer. For me, it’s way over the top. The compiler is really all that I need for my purposes. And no need to register or become part of another community.


#9

I’m not a fan either. I do all of my stuff in a unix-y or linux environment.
I like to compile/execute from the command line without an ide if possible.
I’m not sure how to do that in windows. I’ve been forced into things like eclipse/VS when I’ve used windows before.


#10

The install that @ionatan pointed to went really smooth and I’m up and running with a C compiler, and a fresh install of Python 3.6.2. What I like right off the bat is having a bash.


#11

wow this is so cool
i like it


#12

As do I, but I’m sure from a totally different perspective. All these years in the confines of JS and PHP when all the while C and C++ were behind it all. That’s what’s got me. Peering into the architecture underneath those languages is an eye opener, to be sure.

Aside

This is not a quest for the holy grail. JS and PHP are both very powerful languages that more than serve their particular need. That is their beauty, but at their core, C is running the show. We’re a long ways from picturing how that is pulled off. Thank you, JS and PHP. We don’t have to know, only want to know.