J'aimerais convertir cette fonction VBA en C++. J'aimerais avoir votre avis pour la conversion en C++.
Dois-je reproduire simplement les boucles if et for, ou puis-je utiliser des trucs propres au C, genre constructeurs, classes....
Merci


Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
Sub nouvelle_fonction()
 With Range("A1")
 nblignes = 60
 
For a = 9 To 169
     If maximum(Range("A1").Cells(3, a - 1), Range("A1").Cells(3, a),     Range("A1").Cells(3, a + 1)) = True Then
             .Cells(3, a).Interior.ColorIndex = 4
          Range("A1").Cells(100, a) = .Cells(3, a)
          extremeg = a: extremed = a:
 
          For i = 3 To nblignes
                r = extremeg
                bip = 0
                If maximum(.Cells(i + 1, r - 2), .Cells(i + 1, r - 1), .Cells(i + 1, r))  = True Then
                    extremeg = extremeg - 1
                    bip = 1
               End If
 
               If bip = 0 Then
                       If maximum(.Cells(i + 1, r), .Cells(i + 1, r + 1), .Cells(i + 1, r +  2)) = True Then
                       extremeg = extremeg + 1
                       End If
              End If
 
              bipd = 0
              r = extremed
             bipd = 0
               If maximum(.Cells(i + 1, r), .Cells(i + 1, r + 1), .Cells(i + 1, r + 2)) = True Then
                    extremed = extremed + 1
                    bipd = 1
               End If
 
               bip3 = 0
               If bipd = 0 Then
 
               If maximum(.Cells(i + 1, r - 2), .Cells(i + 1, r - 1), .Cells(i + 1, r)) = True Then
                extremed = extremed - 1
                bip3 = 1
                End If
 
               If bip3 = 0 And maximum(.Cells(i + 1, r - 1), .Cells(i + 1, r), .Cells(i + 1, r + 1)) <> True And extremeg <> extremed Then extremed = extremed - 1
               End If
 
               b = coloriage(a, i + 1, extremeg - 1, extremed)
               If b = 0 Then i = nblignes
               Next i
        End If
 Next a
End With
End Sub