namespace std; // function to print the menu void printMenu() { cout<<"Program 1: Gladiolus"<
#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.


Step by step
Solved in 2 steps with 1 images









