Hi, parent trying to help out my son here. My son is finishing up 6th grade. He finished AOPS Python I, Alphastar Python. Now, he needs to know what to learn next. He is good at math competitions, which is why we think USACO would be a good pursuit for him. Should he learn Java next and reach Gold before switching to C++/Platinum? Or should he learn C++ next from the very beginning and just do USACO Bronze/gold/platinum using C++? Thank you! Please note that we don’t know any coding at all so we would not be able to help him out with his learning. Thank you.
It… honestly depends. I started with Python and then went on to Java and finally C++, but I don’t see how learning C++ before Java would be any harder.
In the end, the understanding of algorithms is usually much harder than the implementation of them.
I would personally recommend this; however, like @SansPapyrus683 said, the problem-solving and algorithmic thinking skills is what is more important for making USACO Gold.
This link is helpful: https://usaco.guide/general/choosing-lang?lang=cpp#what-language-should-i-start-out-with
I have done AOPS python II, but python I seems like very beginner, but Alphastar is usually advanced. I am a silver competitor and I think Java would be better to learn(although I am coding in java, I am not biased). This is because Java is a very high level language. Like python, this means that the code is more like human language and would not look like gibberish. For example, lets say we want to print out the elements of the list [1,2,3], java code would look something like,
for(int x = 0; x < 3; x++) {
System.out.println(list[x]);
}
while C++ would look like,
for(x = list.begin(); x != list.end(); ++x){
std::cout<<(*x)->list;
}
Since java is more readable and easy to learn, I would recommend starting with Java and switching over to C++ in gold/plat. Java and Python writing styles are very similar, but C++ is a bit more complicated. Finally, although C++ is faster than Java, USACO will compensate this with an extra 3 seconds for Java code. Also recommend taking AoPS Python II before USACO, it will help(As mentioned above I also did the course, great course which really utilizes ones mind).
You’re definitely biased
This doesn’t look like valid code in either language. With regards to printing out a list, Java and C++ don’t differ by much …
import java.util.*;
public class test {
public static void main(String[] args) {
List<Integer> x = List.of(1,2,3);
// method 1
for (int i: x) System.out.println(i);
System.out.println("---");
// method 2
for (Iterator<Integer> it = x.iterator(); it.hasNext(); )
System.out.println(it.next());
}
}
#include<bits/stdc++.h>
using namespace std;
int main() {
vector<int> x{1,2,3};
// method 1
for (int i: x)
cout << i << "\n";
cout << "---\n";
// method 2
for (vector<int>::iterator it = begin(x); it != end(x); ++it)
cout << *it << "\n";
}
Agree with this.
Just wanted to point out that this link has been updated in the last 24 hours.
I mean, go search this up yourself. Sorry, I don’t do c++ so I copied off the web. Also, I meant array/ vector. The reason I said list was because the parents don’t know coding, so list is more easy to interpret than vector or array. And it is true that Java is more readable and high leveled which would make it easier to learn.
Also, if I’m biased, then everyone is. In his position, where his parents can’t help him. Java would be much more straightforward. For example, System.out.println seems a lot more easier to interpret than cout <<…
for(auto& a: list){
cout << a << " ";
}
This is subjective. Also, most people would disagree - System.out.println is much longer than cout (you can just remember cout honestly).
How is Java easier to read?? It’s much longer than C++.
For instance:
// This would be a void method in Java
public static void doSomething(){
}
// This would be a void method in C++
void doSomething(){
}
- It’s easier to understand without the
public
andstatic
Also, C++ has macros, which can significantly improve some of the longer aspects of code, unlike Java
Java’s more like human language? print is more intuitive than cout. Also, longer doesn’t mean easier to read. If a person who didn’t even know coding read java, he can make out a tad bit of the code, but C++? Good luck.
The thing about Java is that you have to learn about heavy OOP principles at first. C++'s syntax is a bit unintuitive at first, but after that it’s all smooth sailing.
Sorry, doesn’t mean it’s harder to read. like, you can read short explanation of a college level proof or a much longer proof that’s more basic. Which would be easier to read?
there’s also printf in C++
If you want, you can do this:
#define print(x) cout << x << endl;
As you can tell by the arguments in the replies, there is no right answer. It is all based on the individual. I personally recommend learning C++ since he is in 6th grade and can take some time learning it. Also, another reason to choose C++ is because Java usually has longer code. So, in CP competitions, you will generally have to be a faster typist with Java than compared to C++. In the latter, the code is shorter and can be simplified even more with macros. As I said before, there is no right answer. Both are great languages and I recommend learning both.
My take is learn Java since its more intuitive, easier to understand with good error messages, and easier to setup your programming environment. It’s not that hard to switch to C++ later if he wants.
Honestly, it’s all on perspective. It’s a personal choice. Also, for the programming environment, he can just use an online IDE.
Thank you… Exactly what I wanted to say, but benq and others would keep beating me down sheesh
“Intuitive” is always relative. When learning Java, it took me a couple weeks just to understand that everything was in a class and whatnot, while in C++ it was very lean and I knew what was happening right from the get-go.
We weren’t beating you down. We were telling you that what you said was either incorrect or biased (leading us to a different opinion).