# Trying to decide which programming language I want to learn

Mark44
Mentor
So those are not called subroutines, they called declarations or prototypes of the functions now a days?
What you're calling subroutines are functions. Both Fortran and Pascal distinguish between blocks of code that return a value (functions) and blocks of code that perform some action (subroutines in Fortran and procedures in Pascal).
Some additional terminology that is used in object-oriented languages is method, a function that is associated with a particular class.

Here is an example of a function prototype. The prototype (or declaration) provides the name of the function (triangleArea), the number of parameters (four) and types of the parameters (all are type double), and the type of value returned (double)
C:
double triangleArea(double sp, double a, double b, double c);
Here is an example of a function definition. The function definition includes the function header and the code for the function.
C:
double triangleArea(double sp, double a, double b, double c)
{
double area = std::sqrt(sp * (sp - a) * (sp - b) * (sp - c));
return area;
}
In large programs, it's often convenient to place the function declarations in their own file -- a header file, usually with a .h file suffix.
The Include folder, in the C drive is called "Header files"?
The Include folder contains the standard library header files. If you write your own header files, you could add them to the Include folder, but this is not a good idea. Usually any user-written header files would be placed in the same folder as the source code for your program.
I am trying to learn the new names which is very important to understand what I am reading. I find Google is very good at that. I read about Solutions, Build solution, Clean Solution. These are all new to me. That Solution and just Compiling the program and Link the Prototype function in the Header files to produce the final executable file( I don't know the name yet). is it .exe?
An application (called a solution in VS) can consist of a number of projects, but at your stage of learning, an application will involve only one project. Building an application entails compiling the code your wrote, which translates the code that you wrote to machine code, and then linking any library code together with your object file. The net result of this is usually an executable (.exe extension), but it's also possible to create a static library file (.lib extension) or a dynamic library (.dll extension). These library files are containers of function code that can be linked into programs that you write.

At this stage, though, you shouldn't concern yourself with library files.

Last edited:
sysprog and yungman
Hi

I just want to learn a language, but I don't know which one is best for me. I did programming back in the 70s and early 80s, mainly in assembly language. I learned Fortran, Basic and Pascal before, but they are so old. I since changed my career to analog and RF electronic designs and had not tough programming since. This is mainly for mind excise, I rather this than crossword puzzles for retirement.

I am thinking about C# or C++ as this is used in firmware design. Another one is like Python because both my grandkids are into gaming, I bought a book of Python for Kids to my teenage grand daughter and she is learning it. So that is like playing with grand kids. One kind I don't want is language for business, I have no interest in business, mainly scientific or maybe gaming.

Any suggestion will be appreciated. Also how to get started when I decide on one language.

Thanks
Python is fine, but if you are interested in numerical simulations, Fortran is still worth considering. The language is old, but it has evolved considerably -- the latest standard is Fortran 2018. It has neat array features like Matlab of Python with numpy. I use the free gfortran compiler, part of gcc.

Hi

I just want to learn a language, but I don't know which one is best for me. I did programming back in the 70s and early 80s, mainly in assembly language. I learned Fortran, Basic and Pascal before, but they are so old. I since changed my career to analog and RF electronic designs and had not tough programming since. This is mainly for mind excise, I rather this than crossword puzzles for retirement.

I am thinking about C# or C++ as this is used in firmware design. Another one is like Python because both my grandkids are into gaming, I bought a book of Python for Kids to my teenage grand daughter and she is learning it. So that is like playing with grand kids. One kind I don't want is language for business, I have no interest in business, mainly scientific or maybe gaming.

Any suggestion will be appreciated. Also how to get started when I decide on one language.

Thanks
If you have already learned a programming language, then learning another should be easy. I also learned BASIC, FORTRAN, PASCAL in my youth. When I learned BASIC, I also had to learn coding logic. After BASIC, I knew coding logic, so learning the other languages were only a matter of becoming familiar with new syntax. Today, I can pick up a new language in a few days just by looking at example programs and imitating them for other purposes, and that's how I learned Python and Prime Programming Language (HP Prime) and whatever that language is that those high-end Casio calculators use. Really, learning another computer language after you've already learned several isn't all that difficult. The biggest problem I have is that, sometimes, while programming my HP Prime, I'll mistakenly use Python syntax for the top line of a loop, and then have to correct it when the compiler detects an error.

yungman
If you have already learned a programming language, then learning another should be easy. I also learned BASIC, FORTRAN, PASCAL in my youth. When I learned BASIC, I also had to learn coding logic. After BASIC, I knew coding logic, so learning the other languages were only a matter of becoming familiar with new syntax. Today, I can pick up a new language in a few days just by looking at example programs and imitating them for other purposes, and that's how I learned Python and Prime Programming Language (HP Prime) and whatever that language is that those high-end Casio calculators use. Really, learning another computer language after you've already learned several isn't all that difficult. The biggest problem I have is that, sometimes, while programming my HP Prime, I'll mistakenly use Python syntax for the top line of a loop, and then have to correct it when the compiler detects an error.
I hope so, I am still trying to learn all the terminologies like Class, Object, Object Oriented programming etc. When it comes down to reading the codes, it's not that intimidating ( I hope).

rcgldr
Homework Helper

Python is extremely slow compared to other languages, unless most of what the code is doing is Python's library code which is written in other languages like C.

Java has limited functionality with native types versus object types such as "int" versus "Integer". Java's native linked list and iterators are terribly designed. There's no way to rearrange a list similar to C++ std::list::splice(), which can "move" one or more nodes within a list or from one list to another. Any operation that changes the linkage in a list will break all iterators to that list (except for the iterator that made the change).

Most low level embedded stuff, like hard drives are written mostly in C with some assembly (for interrupt handling, context switches, ...).

Knowing how to program with common languages will require some adaptation for uncommon languages like APL, with it's fairly large number of greek letter generalized operators that work with scalars, vectors, mutli-dimensional arrays, ... . A somewhat popular example of APL code is an implementation of Conway's game of life, which would normally take quite a few lines of code in a common language, but just one line of code in APL. This example uses some statement separators for a delay and to change display output.

sysprog
@rcgldr from https://www.dyalog.com/uploads/files/presentations/CodeGolfWebinar.pdf $$\mathtt{(\{≢⍸⍵\}⌺3~3∊¨3+0,¨⊢) ~W}$$or in J (with explanation quoted) from https://rosettacode.org/wiki/Category:J
$$\mathtt{life=: (3~3 (+/~e.~3\text {+0,4}\&\{)\text{@,;._3}~]\text{)@(0,0,}\tilde{~} \text{0,.0,.}\tilde{~}\text{])}}$$
In other words, given a life instance, the next generation can be found by:
1. adding extra empty cells, surrounding the life instance,
2. tessellating the result, finding every overlapping 3 by 3 subinstance,
3. totaling the number of live cells in each subinstance,
4. treating a subinstance as a live cell iff that total is a member of the sequence 3,x where x is 3 if the center cell was previously dead, and 4 if the center cell was previously alive (that said, note that 4 is also the index of the center cell, with the sub instance arranged as a flat list).

Thanks

So I just download Visual Studio and I can write the code and compile C#?

My grandson told me just now that C++ is better for writing game programs, is that true? I have no idea.

I went on google, it said C++ is more compact thereby run faster, C# needs a lot of library, it's slower and bigger. That C++ is superior for needing speed and much smaller. Maybe I should look into C++ instead.
I am an "early retired" Visual C++ programmer, and I have switched over to C# WinForms. Writing Windows programs is always a good skill to have as a hobbyist as you can make nice Windows applications. I do still like the C++ language, just that I fund Visual C# to be nicer than Visual C++.

If I recall, I think Microsoft has an API to build gaming apps for the XBox system that uses any of its languages. The fact that the top-level code is in slower C# doesn't really matter since such code would be calling functions that have been written in C++ (or even assembly) to be optimized for performance.

rcgldr
Homework Helper
Regarding Visual Studio, it is possible to create hybrid programs comprised of C#, C / C++ and assembly, by creating a DLL (dynamic link library) for the C / C++ / assembly "unmanaged" code. Visual Studio even supports source level debugging for both the C# and the C / C++ / assembly code.

I just put in and ran a little program on my own!!! This started out as an exercise, but I added in display and making new lines by using <<endl command and put text in it. It worked!! this is my little program:

#include <iostream>
int main()
{
int x = 8;
int y = 6;
std::cout << std::endl;
std::cout << "x-y=" <<x - y << "" << std::endl
<< "x*y=" << x * y << "" << std::endl
<< "x+y=" <<x + y << "";
std::cout << std::endl;
return 0;
}

The cmd.exe shows:

This is my first one. I am stoked.

jtbell and sysprog
Dr Transport
Gold Member
I had a really hard time starting in C/C++ years ago. Might I suggest that you look at Starting Out With C++ Early Objects, Tony Gaddis. I learned from it, still refer to it every time I start a new coding project. (I found some versions online in pdf form.) I have a paperback on my desk and have it loaded on pretty much every computer I work with.

He explains enough to get going and be able to ask intelligent questions on google for what you need to know.

sysprog
wle
If you have already learned a programming language, then learning another should be easy. I also learned BASIC, FORTRAN, PASCAL in my youth. When I learned BASIC, I also had to learn coding logic. After BASIC, I knew coding logic, so learning the other languages were only a matter of becoming familiar with new syntax.
These are all procedural programming languages that are very similar to each other though.

I think there are broadly two reasons to learn a new programming language. The first is that you want to get into or learn more about some specific kind of programming, e.g. systems programming, video game programming, scientific computing, web development, etc. There it's fairly straightforward: you want to look up what programming languages and libraries people in these domains use and start using them yourself.

The second is to learn more about programming and different kinds of programming concepts and approaches in general. What you want to do there is learn some programming languages that are very different from each other. On that:

1) There are a lot of good "single issue" programming languages that concentrate on doing one thing or a few related things well that you can learn a particular programming style from. Some potentially interesting languages I'm aware of:
• ML, Haskell, and similar languages for their pure functional programming approach and the strict static-type inferencing system that this makes possible.
• Smalltalk, for object-oriented programming.
• Erlang, for concurrency.
• Prolog, for its relation/query-driven approach to programming.
• Forth, for its stack-driven model of programming.
• Scheme, for its minimalism and extensibility.
• I'd also include C here, since its model of computing is basically just the von Neumann architecture. (C's features are all meant to map straightforwardly to the basic resources and operations supported by a typical computer consisting of a processor and memory. All of C's basic data types are meant to fit in one or at most a few processor registers.)

2) Most "mainstream" programming languages roughly fall somewhere on a spectrum between C and Lisp in terms of their features and programming styles they support. Java, C#, and C++ are closer to the C end while the more popular dynamic languages (Python, Ruby, Javascript, etc.) are closer to the Lisp end.

Concentrating on Python (it's the language of its "kind" that I happen to be most familiar with) then if you look past its syntax and look at its features and major decisions about how it does things -- supports interactive programming, strong but dynamic typing, all variables are references, automatic memory management, built-in easy-to-use aggregate data types, exception handling, first class functions, supports multiple programming styles, etc. -- then it looks rather like a simplified Lisp dialect but without Lisp's metaprogramming capabilities. AI researcher Peter Norvig wrote a fairly detailed comparison of Python and Lisp here; his reply to this Quora question also succinctly explains what different Lisp programmers might like or dislike about Python.

Last edited:
Mark44
Mentor
I have a question, this it the program:

#include <iostream>
int main()
{
std::cout << "Hello Buggy World"<< std::endl;
std::cout << "this is a test" << std::endl;
std::cout << "test again" << std::endl;
return 0;
}

Is the function main() defined in the <iostream> ? Because if I change to some other names, the build failed.

I am learning to define a function inside the program, I thought
main() is just defined by my program, I guess it's not true.
Every C and C++ program has to have a function named main(). This serves as the entry point for the program. It is not defined in any header -- your code is providing the definition of this function.

The main function can appear in another form with two arguments, which makes it possible to pass arguments to main. If you want to learn more about this feature, do a web search for "C arguments to main".

If you post code, it's a good idea to use code tags. They look like this:
[code=c]
[/code]
The above tag can be used for C or C++.
Also, you can eliminate some typing by a using statement, like so.
C:
#include <iostream>
using std::cout;
using std::endl;

int main()
{
cout << "Hello Buggy World"<<endl;
cout << "this is a test" << endl;
cout << "test again" << endl;
return 0;
}

yungman, sysprog and pbuk
jtbell
Mentor
This is my first one. I am stoked.
Congratulations!

I can sense your struggles, because I started by programming in FORTRAN in college and graduate school (mid 1970s through mid 1980s), although not at the microprocessor level. Then I learned Pascal so I could teach intro programming courses in it, then switched those courses to C++ in the mid 1990s, and stopped teaching them in the mid 2000s.

For introductory teaching and learning, I've always preferred a simple command-line interface. In my C++ days, we used the Unix command line, and the basic commands for compiling, linking and running simple programs. In more advanced classes (taught by other people), students were introduced to industrial-strength IDEs: Eclipse in our case, Visual Studio in your case. The only one I've dabbled with is Xcode for MacOS.

IDEs are valuable and even essential for managing complex projects, but IMHO they get in the way when you're starting to learn programming. You spend more time trying to figure out where everything is, than on the details of the programming language.

For my simple hobby-level programming, I still prefer to use the Unix command line in a MacOS Terminal window, or an xterm window in Linux.

yungman and sysprog
symbolipoint
Homework Helper
Gold Member
This needs a large amount of emphasis!
IDEs are valuable and even essential for managing complex projects, but IMHO they get in the way when you're starting to learn programming. You spend more time trying to figure out where everything is, than on the details of the programming language.

pbuk
Gold Member
IDEs are valuable and even essential for managing complex projects, but IMHO they get in the way when you're starting to learn programming. You spend more time trying to figure out where everything is, than on the details of the programming language.

For my simple hobby-level programming, I still prefer to use the Unix command line in a MacOS Terminal window, or an xterm window in Linux.
That's all very well but the OP is using Windows and doesn't have any experience at the command line. Python (or more accurately Python dependency management using conda and especially pip) can be a real struggle on the Windows command line due mainly to admin/non admin user issues and PATH problems, even if you know what you are doing. For a Windows user, Anaconda or PyCharm takes away this problem and means you can concentrate on your code.

Edit: mixed up threads, this one is about C++ not Python - the same applies though, compiling C++ in Visual Studio is much easier than the Windows command line.

Last edited:
Astronuc
Every C and C++ program has to have a function named main(). This serves as the entry point for the program. It is not defined in any header -- your code is providing the definition of this function.

The main function can appear in another form with two arguments, which makes it possible to pass arguments to main. If you want to learn more about this feature, do a web search for "C arguments to main".

If you post code, it's a good idea to use code tags. They look like this:
[code=c]
[/code]
The above tag can be used for C or C++.
Also, you can eliminate some typing by a using statement, like so.
C:
#include <iostream>
using std::cout;
using std::endl;

int main()
{
cout << "Hello Buggy World"<<endl;
cout << "this is a test" << endl;
cout << "test again" << endl;
return 0;
}
What is Tags? I search google, still don't quite get it.

this is the program I am working with, it looks like what you show, but when I do Ctrl C and copy into the post, I lost all color and indent. This is a screen capture instead of copy, you can see it looks like what you have.

I still don't know what is Tags.

Last edited:
Congratulations!

I can sense your struggles, because I started by programming in FORTRAN in college and graduate school (mid 1970s through mid 1980s), although not at the microprocessor level. Then I learned Pascal so I could teach intro programming courses in it, then switched those courses to C++ in the mid 1990s, and stopped teaching them in the mid 2000s.

For introductory teaching and learning, I've always preferred a simple command-line interface. In my C++ days, we used the Unix command line, and the basic commands for compiling, linking and running simple programs. In more advanced classes (taught by other people), students were introduced to industrial-strength IDEs: Eclipse in our case, Visual Studio in your case. The only one I've dabbled with is Xcode for MacOS.

IDEs are valuable and even essential for managing complex projects, but IMHO they get in the way when you're starting to learn programming. You spend more time trying to figure out where everything is, than on the details of the programming language.

For my simple hobby-level programming, I still prefer to use the Unix command line in a MacOS Terminal window, or an xterm window in Linux.
So far, VS is behaving for me, I am on chapter 3 of the book and I play with quite a few program by creating new projects on VS and type in the lines, experimenting by changing and adding my lines. So far, (knock on wood) it's.........I dare to say, smooth!!! ( I hate saying this!!!)

So far, I deal with colsole cout and cin to input variables, display strings of words, perform simple arithmetic function and display in cmd.exe. Creating a function like "int customfunction()" and call the function in main(). So far so good. no question yet......Knock on wood.

I speak too soon, I do have a question. I am going through all the examples in the book, the book tends to build on the last example for the next. Meaning the next example is using like 90% of the code of the last example. It would be very convenient to save the program of the last example and rename as new program so I don't have to retype the whole thing.

I look at "file", there is no "Save as" option that I can save the program in another name. Is there any way to do this?

Thanks

yungman said:
I still don't know what is Tags.
@Mark44 was referring to bbcode tags (BBcode Guide is linked at the bottom left of PF pages, next to the LaTeX Guide link) which are a kind of markup used on the forums to assign attributes to parts of a post ##-## the suggestion was to wrap your code in between code and /code tags like this:
Mark44 said:
If you post code, it's a good idea to use code tags. They look like this:
[code=c]
[/code]
The result would be:
C:
<< Your code >>

I speak too soon, I do have a question. I am going through all the examples in the book, the book tends to build on the last example for the next. Meaning the next example is using like 90% of the code of the last example. It would be very convenient to save the program of the last example and rename as new program so I don't have to retype the whole thing.

I look at "file", there is no "Save as" option that I can save the program in another name. Is there any way to do this?

Thanks
It's called "Save File As" in MS Visual Studio.

If you use Notepad++, you can choose "Save As" or "Save a Copy As" ##-## the latter lets you make multiple versions while keeping the file open with the prior name.

It's called "Save File As" in MS Visual Studio.

If you use Notepad++, you can choose "Save As" or "Save a Copy As" ##-## the latter lets you make multiple versions while keeping the file open with the prior name.
Actually I referred to saving the whole project. Yes, there is a save .cpp, but that only save one file, I have to go in and create a new folder and put it in before working with the .cpp. Do they have a way to say the all the source files like when they create the new project?

Thanks

pbuk
Gold Member
Do they have a way to say the all the source files like when they create the new project?
File -> New -> Project from existing code

But I wouldn't bother for this purpose, do you really need to save your "Hello World" code for posterity? Just work through the early exercises modifying as you go.

File -> New -> Project from existing code

But I wouldn't bother for this purpose, do you really need to save your "Hello World" code for posterity? Just work through the early exercises modifying as you go.
No no, I way passed that 2 days ago, this is writing a local function and how to declare global variables. It's like the program showed in post #67. I'll try the new project from existing code.

thanks

This is just a comment but I feel very strongly about this. In my days, we do everything in HEX number, it is so so much more intuitive. Studying about ASCII and reading the book remind me that now they use decimal numbers, not HEX or binary anymore. In my days, we are trained to work in HEX or binary because that's how the computer thinks, you actually can see the bits how the signal is. For hardward, this is so important to think in HEX. Decimals don't mean a thing. I don't know why it's so hard for people that they have to change to decimal particular doing firmware ( which is a big big field). What is 65535? If it is 0FFFFH, you know right away it's all 16 1s!!! I just hate it when I design the controller hardware and the programmer talk to me in decimals. Tell me the HEX, I immediately know what signal is what.

I used to program in machine language for Z80 and just type away in HEX to test hardware. People really need to tuff it up and stick the HEX, can't think and do HEX, there might be other career that's better.