namespace std; // function to print the menu void printMenu() { cout<<"Program 1: Gladiolus"<

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
JI need help with my c++ code for a flower here is my code:

#include<iostream>
#include<iomanip>
using namespace std;
// function to print the menu
void printMenu()
{
cout<<"Program 1: Gladiolus"<<endl;
cout<<"Choose from among the following options:"<<endl;
cout<<"1. Display original graphic"<<endl;
cout<<"2. Display Gladiolus"<<endl;
cout<<"3. Exit the program"<<endl;
}
// function to print given number of white spaces
void printSpaceForward(int count)
{
for(int i = 1; i <= count; i++)
cout<<":";
}
// function to display gladiolus flower with given number of sections
void displayGladiolus(int sections)
{
// level of sections
for(int i = 1; i <= sections; i++)
{
printSpaceForward(sections);
cout<<"---"<<endl;
// print the upper part of a level, upto the '@' character level

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

{

printSpaceForward(sections-i);

printSpaceForward(i-j);

 

cout<<"(";

printSpaceForward(j);

if(i==j)

cout<<"@";

else

cout<<":";  // <-- error here

 

printSpaceForward(j);

cout<<")"<<endl;

}

 

// print the lower part of a level

for(int j = i-1; j >= 1; j--)

{

printSpaceForward(sections-i);

printSpaceForward(i-j);

 

cout<<"(";

printSpaceForward(j);

if(i==j)

cout<<"@";

else

cout<<":";  // <-- error here

 

printSpaceForward(j);

cout<<")"<<endl;

}
}
printSpaceForward(sections);
cout<<"---"<<endl;
// print the stem part
for(int i = 1; i <= sections; i++)
{
// for even count, print \|
if(i%2 == 0)
{
printSpaceForward(sections);
cout<<"\\|"<<endl;
printSpaceForward(sections+1);
cout<<"|"<<endl;
}
// for odd count print |/
else
{
printSpaceForward(sections+1);
cout<<"|/"<<endl;
printSpaceForward(sections+1);
cout<<"|"<<endl;
}
}
}
// function to print the graphics

// main method
int main()
{
int choice, sections;
printMenu(); // print the menu
// accept user's choice
cout<<"Your choice -> "<<endl;
cin>>choice;
// compare user's choice and call appropriate methods
switch(choice)
{
case 1: 
break;
case 2: cout<<"Number of sections -> ";
cin>>sections;
if(sections > 0)
displayGladiolus(sections);
break;
case 3: exit(0);
default: cout<<"\nInvalid choice!";
}
cout<<"\nExiting"<<endl;
return 0

 

WHAT I NEED HELP IS WITH GETTING RID OF THE COLONS GETTING PRINTED OUTSIDE OF THE CURLY BRACKETS AND ALSO GET RID OF THE COLONS FROM WHERE THE STEMS(|/,|) ARE SO IF SOMEONE CAN HELP ME WITH THAT, I ONLY WANT THE COLONS TO BE INSIDE OF THE CURLY BRACKETS AND NOT OUTSIDE. UNDERNEATH IS ALSO A PICTURE OF WHAT THE OUTPUT SHOULD.

LOOK LIKE. 

 

{:::}
{:::::}
{:::@:::}
{:::::}
{:::}
{:::}
{::::}
{:::}
{:@:}
Transcribed Image Text:{:::} {:::::} {:::@:::} {:::::} {:::} {:::} {::::} {:::} {:@:}
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education