perimeter of a triangle

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.length - 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?



Thank you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top