Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create an analysis sheet for the code below. It must include a visual representation. - - - - - - - - - - -
Create an analysis sheet for the code below. It must include a visual representation.
TriangularVertices.h
#ifndef TRIANGULARVERTICES
#define TRIANGULARVERTICES
class TriangularVertices
public:
void printTriangleint rows;
private:
void printNumbersRowint row;
void printSlashesRowint row;
void printSpacesBeforeint totalRows, int currentRow;
int calculateStartNumberint row;
;
#endif
TriangularVertices.cpp
#include
#include
class TriangularVertices
public:
void printTriangleint rows;
private:
void printNumbersRowint row;
void printSlashesRowint row;
void printSpacesBeforeint totalRows, int currentRow;
int calculateStartNumberint row;
;
void TriangularVertices::printTriangleint rows
for int i ; i rows; i
printSpacesBeforerows i;
printNumbersRowi;
std::cout std::endl;
if i rows
printSpacesBeforerows i;
printSlashesRowi;
std::cout std::endl;
void TriangularVertices::printNumbersRowint row
int startNumber calculateStartNumberrow;
for int i ; i row; i
std::cout std::setw startNumber i;
if i row
std::cout ;
void TriangularVertices::printSlashesRowint row
std::cout std::setw;
for int i ; i row; i
std::cout ;
if i row
std::cout ;
void TriangularVertices::printSpacesBeforeint totalRows, int currentRow
int spaces totalRows currentRow;
for int i ; i spaces; i
std::cout ;
int TriangularVertices::calculateStartNumberint row
return row row ;
Source.cpp
#include "TriangularVertices.h
#include
int main
TriangularVertices tv;
int rows;
do
std::cout "How many triangular vertices rows do you want to display? Enter an integer from to : ;
std::cin rows;
if rows rows
std::cout "Invalid input. Please enter a number from to
;
while rows rows ;
tvprintTrianglerows;
return ;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started