How do you guys like to study for programming?

Good morning (or afternoon)!

I was just wondering, how do you guys like to study for programming? I'm currently taking my second semester of C++ but I'm pretty bad at studying in general. People say the best way is to just practice coding, but I was wondering if anyone can elaborate on that a bit based on their personal experience.

Right now I'm studying for a test and I'm writing this code just to familiarize myself with the material:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
void FillAVector(vector<int> &vector1);
void FindANumber(vector<int> &v1);
void RemoveANumber(vector<int> &v1);
void MakeAStack(list<int> &l1);

void RunPracticeFunctions()
{
	vector<int> vector1 = { 2, 4, 4, 7, 8, 5, 6 };

	cout << "Finding number: " << endl;
	FindANumber(vector1);
	printVector(vector1);
	//FillAVector(vector1);
	RemoveANumber(vector1);
	printVector(vector1);

	list<int> list1 = { 6, 8, 14, 3 };

	MakeAStack(list1);
}

void FillAVector(vector<int> &v1)
{
	fill(v1.begin() + 2, v1.end() - 1, 7);

	ostream_iterator<int> screen(cout, " ");
	cout << "Filled vector with 7's from first index to index: " << endl;
	copy(v1.begin(), v1.end(), screen);
	cout << endl;
}

void FindANumber(vector<int> &v1)
{
	vector<int>::const_iterator iter = v1.begin();

	iter = find(v1.begin(), v1.end(), 5);

	if (iter != v1.end())
	{
		cout << "5 found at position " << (iter - v1.begin()) << endl;
	}
	else
		cout << "5 not found in vector" << endl;
}

void RemoveANumber(vector<int> &v1)
{
	vector<int>::iterator iter;

	iter = remove(v1.begin(), v1.end(), 4);
}

void MakeAStack(list<int> &l1)
{
	list<int>::const_iterator iter;
	stack<int> s1;

	for (iter = l1.begin(); iter != l1.end(); iter++)
	{
		s1.push(*iter);
	}
	
	while (s1.size() != 0)
	{
		cout << s1.top() << " ";
		s1.pop();
	}
}


And I plan to keep trying to write additional functions for stuff that needs to be covered. What do you guys think? Is this how you did it? Would something like this work for you? Please share some studying techniques if you'd like! The testing aspect of programming is always what I've found to be the hardest by a stretch, so improving studying habits would help a ton.
Topic archived. No new replies allowed.