N
NJpixie
Hello,
Here is my code of a perimeter of a triangle such as:
2
1 7
3 6 8
4 2 5 3
#include <iostream>
using namespace std;
int perimeterSum (int[][]A, int Size);
int main()
}
int perimeterSum(int[][]A, int size){
int sum = 0;
// the left-hand side (the first column)
for (int i = 0; i < size; i++)
sum += A[0];
// the bottom row, except the first element
for (int i = 1; i < size; i++)
sum += A[A - 1];
// the diagonal except the first and last elements
for (int i = 1; i < size - 1; i++)
sum += A;
return sum;
}
}
i am only on chapter 3 so the code needs to be very basic using:
int perimeterSum (int[][] A, int Size) {
int sum = 0;
I tried this code but i got 4 errors in visual c++.
What am I doing wrong?
Thanks for the advice
Here is my code of a perimeter of a triangle such as:
2
1 7
3 6 8
4 2 5 3
#include <iostream>
using namespace std;
int perimeterSum (int[][]A, int Size);
int main()
}
int perimeterSum(int[][]A, int size){
int sum = 0;
// the left-hand side (the first column)
for (int i = 0; i < size; i++)
sum += A[0];
// the bottom row, except the first element
for (int i = 1; i < size; i++)
sum += A[A - 1];
// the diagonal except the first and last elements
for (int i = 1; i < size - 1; i++)
sum += A;
return sum;
}
}
i am only on chapter 3 so the code needs to be very basic using:
int perimeterSum (int[][] A, int Size) {
int sum = 0;
I tried this code but i got 4 errors in visual c++.
What am I doing wrong?
Thanks for the advice