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

  • Home
  • SEARCH
  • 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 6901929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:44:06+00:00 2026-05-27T07:44:06+00:00

I am doing a homework assignment that involves writing a program to draw shapes

  • 0

I am doing a homework assignment that involves writing a program to draw shapes with ASCII characters and move them across the screen. In this example, I am trying to write a method to move a circle that has already been drawn. I know my drawCircle method works, however when I try to call the drawCircle method in my moveCircle method it does not print anything out.

void CircleType::drawCircle() const{
    for (int i = 0; i < NUMBER_OF_ROWS; i++) {
        for(int j = 0; j < NUMBER_OF_COLUMNS; j++) {
            int p = abs (x - j);
            int q = abs (y - i);
            int distance =  pow(p, 2) + pow(q, 2);
            int realDistance = pow(radius, 2);
            if (abs(realDistance - distance) <= 3){ // I tested out several values here, but 3 was the integer value that consistently produced a good looking circle
                drawSpace[i][j] = symbol;
            }
        }
    }
    displayShape();
    return;
}




bool CircleType::moveCircle(int p, int q){
    if (p - radius < 0 || p + radius > NUMBER_OF_COLUMNS){
        cout << "That will move the circle off the screen"<< endl;
        return false;
    }
    else if (q - radius < 0 || q + radius > NUMBER_OF_ROWS){
        cout << "That will move the circle off the screen"<< endl;
        return false;
    }
    else{
        x = p;
        y = q;
        for (int m = 0; m < NUMBER_OF_ROWS; m++){
            for(int n = 0; n < NUMBER_OF_COLUMNS; n++){
                if (drawSpace[m][n] == symbol)
                    drawSpace[m][n] = ' ';
            }
        }
        void drawCircle();
        return true;
    }

}

drawSpace is a 2D char array that holds the ASCII characters for the shape, and displayShape is a function that prints out that 2D array. As I said above, the drawCircle function works, however the moveCircle method does not. Am I calling the drawCircle method wrong when I try to use it in moveCircle.

  • 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-05-27T07:44:07+00:00Added an answer on May 27, 2026 at 7:44 am
    void drawCircle();
    

    That is not a function call; it is a function prototype declaration. To call the function, simply use

    drawCircle();
    

    A function prototype simply tells the compiler that a function with a certain signature exists. This allows you do do something like this (though this is not at all common to do in this way).

    int main() {
        void Foo();
        Foo();
    }
    
    void Foo { /* whatever */ }
    

    If the prototype were omitted the compiler would throw an error as Foo was not declared before its use. In a similar (and more common) vein you could also do this (called a forward declaration).

    void Foo();
    
    int main() {
        Foo();
    }
    
    void Foo { /* whatever */ }
    

    Or just declare it first, but you don’t usually want a ton of functions before main.

    void Foo { /* whatever */ }
    
    int main() {
        Foo();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing a homework assignment that deals with classes and objects. In it,
I am doing a homework assignment that reads in a book. First, a line
A homework assignment asks me to implement a program that counts the words in
I'm doing a homework assignment in C. I have to build a calculator that
I'm doing a basic homework assignment which looks like this: While input <> -1
I'm doing a homework project that requires this: Below you will find the code
I'm doing a homework assignment in which I need to print out to the
BACKGROUND: I'm writing a single level cache simulator in C for a homework assignment,
I am doing a college assignment in Java that deals with currency. For that
I am doing a little homework assignment in which we are making a very

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.