Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8785067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:15:31+00:00 2026-06-13T21:15:31+00:00

I have an assignment in which i have to create a console program in

  • 0

I have an assignment in which i have to create a console program in c++ that draws Hexagons in a given style. The problem i am having is; my For loops are never entered and i can’t figure out why. here’s the snippet of code I’m having trouble with.

    void display()
{
    int counter=0;//var that keeps track of the layer that is being drawn
    for(int i=0;i>=size;i++)//spaces before first layer of hexagon
    {
        cout<<" ";
    }
    for (int k=0; k>size;k++)//top layer of hexagon
    {
        cout<<"_";
    }
    cout<<endl;//ends the first layer
    for (counter; counter>=size-1;counter++)//outer loop for the top half that controls the size
    {
        for( int j=0;j>(size-counter);j++)//adds spaces before the shape
        {
            cout<<" ";
        }
        cout<<"/";
        for( int p=0; p>(size+(counter*2));p++)//loop for the hexagon fill
        {
            cout<<fill;
        }
        cout<<"\\"<<endl;
    }
    for(counter;counter==0;counter--);  //loop for bottom half of the hexagon
    {
        for( int j=0;j>(size-counter);j++)//adds spaces before the shape
        {
            cout<<" ";
        }
        cout<<"\\";
        for( int p=0; p>(size+(counter*2));p++)//loop for the hexagon fill
        {
            cout<<fill;
        }
        cout<<"/"<<endl;
    }
    cout<<"\\";
    for(int r=0; r>=size;r++){cout<<"_";}
    cout<<"/"<<endl;

}

the ‘Size’ and ‘fill’ are selceted earlier in the program during my main()
I’m probably missing something very simple but I’ve been struggling with this for a while. Any help would be greatly appricated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:15:33+00:00Added an answer on June 13, 2026 at 9:15 pm

    I am not sure what is the content of your size variable but it looks like you have got your loop conditions wrong:

    for(int i=0;i>=size;i++)
    

    probably should be:

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

    The same goes for other loops.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an assignment in which I need to create a function that tells
I have an assignment to create a program that converts deci (-32,768 through 32,767)
I have an assignment to create a GUI using MATLAB GUIDE and am having
I have a database assignment which I have to create some relational algebra for
I have an assignment in which I need to create a unix shell using
So I have this University assignment in which I have to create a trigger
Have a homework assignment in which I'm supposed to create a vector of pointers
I have an assignment problem that i can't manage to fix and got totally
I have a programming assignment and we are asked to create a program in
I have a school assignment where I need to create a data-driven style of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.