Hi Guys!

I am very very new to C++. This is a code written in vb.NET previously.

This is a button click command:

Code:

Dim p As New List(Of Long)
k = 3
m = 2
p.Add(m)
For n = 1 To k
For l = 0 To n
If m Mod p(l) = 0 Then
m = m + 1
End If
Next l
p.Add(m)
Next n
Beep()
Me.TextBox2.Text = m

I wrote:

Code:

int k = 3;
int m = 2;
std::list<int> p;
p.push_back(m);
for( int n = 1; n < k; n++ ) {
for( int l = 0; l < n; l++ ) {
if ( m % p(l) == 0 );
{
m = m + 1;
};
};
p.push_back(m);
};
System::String^ b = m.ToString();
textBox2->Text = b;
};

I am sure I am using functions wrong like "push_back".

Ofcourse it's not working. Can you help me?

Thanks a lot!