Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include #include / / TODO: implement this function to return a Pascal Triangle std::vector > pascalTriangle ( int row ) { return { }

#include
#include
#include
// TODO: implement this function to return a Pascal Triangle
std::vector> pascalTriangle(int row){
return {};
}
// TODO: implement this function to print Pascal Triangles
void printPascalTriangle(const std::vector>& triangle){
}
// TODO: implement this function to return comparison result. See main() for usage.
std::vector compare(const std::vector>& triangle,
const std::vector allegedSummations){
return {};
}
int main()
{
// part 1: generate and print Pascal Trieangle
int rows =8;
auto triangle = pascalTriangle(rows);
printPascalTriangle(triangle);
std::cout << std::endl;
// part 2: check alleged summations
// expected returrn: {1,1,0,1,0,1,0,1,1,0}
std::vector allegedSum{1,2,5,8,17,32,65,128,256,511};
auto sumCheck = compare(pascalTriangle(allegedSum.size()), allegedSum);
for (auto b : sumCheck){
std::cout << b <<"";
}
std::cout << std::endl;
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Navigating The Supply Chain Maze A Comprehensive Guide To Optimize Operations And Drive Success

Authors: Michael E Kirshteyn Ph D

1st Edition

B0CPQ2RBYC, 979-8870727585

More Books

Students also viewed these Databases questions