Question
keep it as simple as possible. do not use any advanced algorithm or functions.
Based on 2d arrays and other basic C++ functions
first picture is the start of the program plz follow
const int HAXTBLSIE100 theable ssze 100 int main void 무{ nt tg3ize int ebaiee ea c for 4 int 1-0, choice -i “ tilesane [1] !-.., i.., 白 printTrg . table, trgSize): tindPathO princPathOeeda par ein ehoiee Save the oatpat belo
media%2F45c%2F45c93b04-a1f3-4e73-83f4-63
0 0
Add a comment Improve this question Transcribed image text
Answer #1

//C++ program

#include<bits/stdc++.h>

using namespace std;

  

int main()

{ int row;

cin>>row;

int triangle[row][row] ;

for(int i=0;i<row;i++)

for(int j=0;j<row;j++)

triangle[i][j]=0;

for(int i=0;i<row;i++){

for(int j=0;j<=i;j++){

cin>>triangle[i][j];

}

}

for(int i=0;i<row;i++){

for(int j=0;j<=i;j++){

cout<<triangle[i][j]<<" ";

}

cout<<"\n";

}

for (int i=row-2; i>=0; i--)

{

for (int j=0; j<=i; j++)

{

if (triangle[i+1][j] > triangle[i+1][j+1]) {

triangle[i][j] += triangle[i+1][j];

}

  

else

triangle[i][j] += triangle[i+1][j+1];

}

}

cout <<triangle[0][0];

return 0;

}

Add a comment
Know the answer?
Add Answer to:
keep it as simple as possible. do not use any advanced algorithm or functions. Based on...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using simple and basic C++ (do not use #include <algorithm>), write two functions (one for a...

    Using simple and basic C++ (do not use #include <algorithm>), write two functions (one for a sorted arrays of integers and one for an unsorted array of integers) to check if any pair of elements in an array of integers add up to 20 and print all the pairs that do

  • Practical 5: Write a program that implements several sorting algorithms, and use it to demonstrate the comparative perfo...

    Practical 5: Write a program that implements several sorting algorithms, and use it to demonstrate the comparative performance of the algorithms for a variety of data sets. Need Help With this Sorting Algorithm task for C++ Base Code for sorting.cpp is given. The header file is not included in this. Help would be much appreciated as I have not started on this due to personal reasons #include <cstdlib> #include <iostream> #include <getopt.h> using namespace std; long compares; // for counting...

  • Concepts tested by the program: Working with one dimensional parallel arrays Use of functions Use of...

    Concepts tested by the program: Working with one dimensional parallel arrays Use of functions Use of loops and conditional statements Description The Lo Shu Magic Square is a grid with 3 rows and 3 columns shown below. The Lo Shu Magic Square has the following properties: The grid contains the numbers 1 – 9 exactly The sum of each row, each column and each diagonal all add up to the same number. s is shown below: Write a program that...

  • DO NOT USE ANY EXTERNAL LIBRARIES! KEEP IT SIMPLE!!! import java.util.Scanner; public class StoryTime {   ...

    DO NOT USE ANY EXTERNAL LIBRARIES! KEEP IT SIMPLE!!! import java.util.Scanner; public class StoryTime {    /*Method name : descrambler() @returns: String @param: int @param: String */ // Make your method here    public static void main(String[] args) {        StoryTime s = new StoryTime();        Scanner scn = new Scanner(System.in);        System.out.println("Pick 1 for a joke or 2 for a Short Scary Story");        int input = scn.nextInt();        String str = "Juswert alois...

  • In C++ please! *Do not use any other library functions(like strlen) than the one posted(<cstddef>) in the code below!* /** CS 150 C-Strings Follow the instructions on your handout to complete t...

    In C++ please! *Do not use any other library functions(like strlen) than the one posted(<cstddef>) in the code below!* /** CS 150 C-Strings Follow the instructions on your handout to complete the requested function. You may not use ANY library functions or include any headers, except for <cstddef> for size_t. */ #include <cstddef> // size_t for sizes and indexes ///////////////// WRITE YOUR FUNCTION BELOW THIS LINE /////////////////////// ///////////////// WRITE YOUR FUNCTION ABOVE THIS LINE /////////////////////// // These are OK after...

  • In this question, you will test, using a backtracking algorithm, if a mouse can escape from...

    In this question, you will test, using a backtracking algorithm, if a mouse can escape from a rectangular maze. To ensure consistency of design, start your solution with maze_start.c. The backtracking algorithm helps the mouse by systematically trying all the routes through the maze until it either finds the escape hatch or exhausts all possible routes (and concludes that the mouse is trapped in the maze). If the backtracking algorithm finds a dead end, it retraces its path until it...

  • This is an advanced version of the game tic tac toe, where the player has to...

    This is an advanced version of the game tic tac toe, where the player has to get five in a row to win. The board is a 30 x 20. Add three more functions that will check for a win vertically, diagonally, and backwards diagonally. Add an AI that will play against the player, with random moves. Bound check each move to make sure it is in the array. Use this starter code to complete the assignment in C++. Write...

  • Below is my code and the instructions for the code. I can't figure out what's wrong....

    Below is my code and the instructions for the code. I can't figure out what's wrong. Please help. Tasks This lab has two parts: Writing a searching function for 1D arrays. Writing a simple class. Part 1 – Searching Continuing with arrays, we will now expect you to find information in an array and derive useful properties from the information stored in an array. Start Eclipse. Change the workspace directory location to something "safe". You may want to temporarily choose...

  • I only need the "functions" NOT the header file nor the main implementation file JUST the impleme...

    I only need the "functions" NOT the header file nor the main implementation file JUST the implementations for the functions Please help, if its difficult to do the complete program I would appreciate if you could do as much functions as you can especially for the derived class. I am a beginer so I am only using classes and pointers while implementing everything using simple c++ commands thank you in advanced Design and implement two C++ classes to provide matrix...

  • DO NOT USE ANY EXTERNAL LIBRARIES BESIDES BUILT IN JAVA LIBRARIES! KEEP IT SIMPLE!!! Provided Code:...

    DO NOT USE ANY EXTERNAL LIBRARIES BESIDES BUILT IN JAVA LIBRARIES! KEEP IT SIMPLE!!! Provided Code: import java.util.Scanner; public class OddAndEven{ /* PART 1: Create a nonstatic method that takes in an int number quantity (n) and returns a returns a String of numbers from 0 to n (inclusive) as the example above demonstrates. Call this quantityToString.    In this method you should check that n is between 0(inclusive) and 100(inclusive). If n is outside these boundaries return and empty...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT