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 6773699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:41:56+00:00 2026-05-26T15:41:56+00:00

//============================================================================ // Name : Assignment.cpp // Author : Tim Bialecki // Version : //============================================================================

  • 0
    //============================================================================
// Name        : Assignment.cpp
// Author      : Tim Bialecki
// Version     :
//============================================================================

#include <iostream>
#include <math.h>
using namespace std;

void circle(int x, int y, int radius);
void line(int a, int b, int c, int d);
bool buffer[26][81];
char drawSpace[26][81];

int main() {
    int a = 75;
    int b = 5;
    int c = 4;
    int d = 26;
    /*cout << "please enter an x coordinate for the center of the circle";
    cin >> x;
    cout << "please enter a y coordinate for the center of the circle";
    cin >> y;
    cout << "please enter a value for the radius of the circle";
    cin >> radius;*/

    circle(a, b, c);
    for (int col = 80; col >= 0; col--) {

        for (int row = 25; row >= 0; row--) {
                cout << drawSpace[row][col];
            }
        cout << "\n";
        }
    return 0;
}

void circle(int x, int y, int radius){
    /*if (x + radius >= 81 || y + radius >= 26 || y - radius <= 26){
        cout << "the coordinates provided for the circle will not fit on the screen" << endl;
        return;
    }*/

    for (int i = 0; i < 26; i++) {
        for(int j = 0; j < 81; j++) {
            int a = abs (x - j);
            int b = abs (y - i);
            int distance =  pow(a, 2) + pow(b, 2);
            int realDistance = pow(radius, 2);
            if (abs(realDistance - distance) <= 3){
                buffer[i][j] = true;
            }
        }
    }

    for (int m = 0; m < 26; m++){
        for(int n = 0; n < 81; n++){
            if (buffer[m][n]){
                drawSpace[m][n] = 42;
            }
            else
                drawSpace[m][n] = 32;
        }
    }
}

void line(int a, int b, int c, int d){
    int intercept = 0;
    double rise = d - b;
    double run = c - a;
    double slope = rise/run;
    intercept = b - (slope*a);
    for (int i = 0; i < 26; i++) {
        for(int j = 0; j < 81; j++) {
            int newIntercept = i - (slope*j);
            int test = abs (intercept - newIntercept);
            if (test <= 0)
                buffer[i][j] = true;
            else
                buffer[i][j] = false;
        }

    }

    for (int m = 0; m < 26; m++){
        for(int n = 0; n < 81; n++){
            if (buffer[m][n])
                drawSpace[m][n] = 42;
            else
                drawSpace[m][n] = 32;
        }
    }
}

This code is a work in progress, but I’m trying to write a program that takes inputs for the coordinates and dimensions of both a line and a circle and prints them out in the terminal window as if it were a 81×26 graph. I have just supplied sample inputs to test this out, but for some reason the shapes are not printing with the appropriate orientation to what should be the x and y axises. I have tried a bunch of different ways of trying to fix this problem and have had no luck. Hoping someone can help. Thanks

  • 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-26T15:41:56+00:00Added an answer on May 26, 2026 at 3:41 pm

    Looks OK to me:

                   ***    
                 **   **  
                 *     *  
                *       * 
                *       * 
                *       * 
                 *     *  
                 **   **  
                   ***    
    

    It’s not perfectly round because characters are taller than they are wide.

    EDIT: That’s only the first few rows on my output. Based on the comment and a second look at the code, I think rows and columns are getting mixed up.

     for (int col = 80; col >= 0; col--) {
        for (int row = 25; row >= 0; row--) {
                cout << drawSpace[row][col];
            }
        cout << "\n";
        }
    

    There’s a newline after every “column”. Swapping the two for lines may produce what you want.

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

Sidebar

Related Questions

The name of a temporary table such as #t1 can be determined using select
class Name implements Runnable { public void run() { for (int x = 1;
struct WeatherStation { string Name; double Temperature; }; void Initialize(WeatherStation[]); void HL(WeatherStation List[]); int
My assignment asks me to access a test.txt document, so the file name has
So my assignment is to create multiple classes for a Person, Name, ID #,
HI all, I have a text file include this: set_global_assignment -name FA titan VII
Name of the option tells something but what Visual Studio/compiler really do and what
Name the design considerations in deciding between use of a singleton versus a static
Name: <%= Html.TextBox(txtName, 20, new { @class = hello }) %> I want that
var name = 'Mike'; var person = { name: 'John', welcome: function(){ var name

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.