Member Avatar

Well we all have seen the common questions on creating squares and hollow squares out of asterisks in C++, but how about creating a program that prints out a circle in asterisks? Obviously this would look like an oval due to line adjustment, but it would be quite interesting to see if someone could do it. I have tried myself and I must admit it is a fairly decent challenge. If you figure it out, post your code here! Hint: r^2 = x^2 + y^2

Member Avatar
+2 forum 11
Member Avatar

I need to check my code has all these requirements. The requirements for “main()” are: a. Use an object. b. Declare all required variables. c. Output user information. d. Input the radius 1 and radius 2 to be used to calculate the area of two circles. e. Use object Circle to access an array that contains the radius of the two circles. f. Use a function to display the area of the two circles. Requirements for the function to display the area of the two circles: a. The function is a void function. b. The function receives the Circle object …

Member Avatar
+0 forum 7
Member Avatar

If you draw a series of close spaced shapes your eyes get fooled to see Moire patterns. Here is one example of this.

+2 forum 0
Member Avatar

Hello i have a little problem with moving ball around screen, also i'm confused why i cannot put this variables `double x = 0, y = 16, muvx = 0, muvy = 0;` at the public class MainActivity to be local variables and also i don't know how to set the timer to be on 0.5 sec. `Timer t = new Timer(this, 5);` its shows me error at this line too. Here is the code please explain me what causes the errors and how do i make the ball move, Thank you public class MainActivity extends Activity { static int …

Member Avatar
+0 forum 3
Member Avatar

Hi everyone, i need your help.. I want to draw a circle,square and rectangle on Jframe on a click of a button.. This program was asked in my test paper, i couldn't get it right though bt i wanna know what my mistake is.. Plz help me.. import javax.swing.*; import java.awt.*; import java.awt.event.*; public class CRS extends JFrame implements ActionListener { JButton b1,b2,b3; Graphics g; Container con; public CRS() { super("Draw Circle in JFrame"); con=getContentPane(); con.setLayout(new FlowLayout()); b1=new JButton("Circle"); b2=new JButton("Rectangle"); b3=new JButton("Square"); con.add(b1); con.add(b2); con.add(b3); b1.addActionListener(this); b2.addActionListener(this); b3.addActionListener(this); } public void Circle() { g.drawOval(50,50,100,100); } public void Rectangle() { …

Member Avatar
+0 forum 1
Member Avatar

Write a Java application that prompts and reads a value representing the radius, of a circle, then prints the circle's circumference and area. I do not know where to start

Member Avatar
+0 forum 15
Member Avatar
Reusable Code Snippet Save a PyGame drawing

You can draw a number of shapes directly on the PyGame window, and then save the drawing to an image file.

+3 forum 0
Member Avatar

namespace play_stop { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button4_Click(object sender, EventArgs e) { timer1.Interval = 1000; timer1.Start(); Counter = 0; } public void circles() { Graphics g = panel1.CreateGraphics(); g.DrawEllipse( new Pen(Color.Red),panel1.Width / 2, panel1.Height / 2,75, 75); Graphics h = panel1.CreateGraphics(); h.DrawEllipse( new Pen(Color.Blue), panel1.Width / 2, panel1.Height / 2, 50, 50); Graphics j = panel1.CreateGraphics(); j.DrawEllipse( new Pen(Color.Yellow), panel1.Width / 2, panel1.Height / 2, 80,80); Graphics k = panel1.CreateGraphics(); k.DrawEllipse( new Pen(Color.Green), panel1.Width / 2, panel1.Height / 2, 100,100); } public int counter; public int Counter { get { …

Member Avatar
+0 forum 6
Member Avatar

Write a Python program that draws a circle with radius 50 pixels and centered at the center of the canvas. Give the canvas white background color and make it expand with its frame whenever the user resizes the frame. The program will respond to some mouse and keyboard events as described below. Whenever the left mouse button is pressed, display a message indicating whether the mouse pointer is inside the circle as shown in the figures below. The center of the message's baseline should be at the center of the circle. Moreover, the message should be displayed using a random …

Member Avatar
+0 forum 3
Member Avatar

Hello, I am currently working on a school project and ran into a little bit of trouble. Every time I compile the program I get 2 errors they are: cirlce.java:23: incompatible types found : java.io.IOException required: char letter = get.ioException(); ^ cirlce.java:37: possible loss of precision found : double required: int a = pi*r*r; ^ Ive tried everything i could think of. Thank you for looking and helping. [CODE]// By: // Circle program import java.io.IOException; import java.util.Scanner; public class cirlce { public static void main(String []args)throws IOException { Scanner get = new Scanner(System.in); double pi = 3.14159265; int d; int …

Member Avatar
+0 forum 9
Member Avatar

I made a creature composed of shapes in a Java Applet. I want to basically copy and paste the creature I made so I have say 7-8 copies on the same applet. but in different locations. Is there an easy way besides copying the entire code, and moving each coordinate by the same amount? Thanks

Member Avatar
+0 forum 10
Member Avatar

I am trying to draw circle in the upper left corner of a graphics window, and then move that circle at a diagonal to the bottom right corner, and then bounce it back to the upper left, and so on until my loop is exhausted. I can't get my moving circle to reverse direction at the first bounce point (first if-statement inside for loop), and I don't know why... [CODE] from graphics import* def main(): # create a 200 x 200 graphics window win = GraphWin() x = 10 y = 10 # create a circle of radius 10 at …

Member Avatar
+0 forum 1
Member Avatar

how to add circle marker on google map by giving latitude,longitude and radius in KM?

Member Avatar
+0 forum 2
Member Avatar

circle.h [code] // // circle.h // defines the functions to draw circle. // #ifndef CIRCLE_H #define CIRCLE_H #include <windows.h> typedef struct tagCircle { int x; int y; int radius; } Circle; /* set the window handle */ void SetWindowHandle(HWND); /* set pixel @parms int x xposition @parms int y yposition @parms Color color of the pixel. @returns void */ void Circle_SetPixel(int,int,COLORREF&); /* circle dawing function @parms int x x position of the circle to be drawn @parms int y center y position. @parms int radius radius of the circle. */ void DrawCircle(int,int,int); #endif // END CIRCLE_H [/code] circle.cpp [code] #include …

+2 forum 0
Member Avatar

im' confuse with this function...how do i call one function so it can be used in another function?? [ICODE]#include <iostream> #include <cmath> using namespace std; double pi=3.1416; double getinput(); double distance(double,double,double,double); double radian(double); double circumferences(double); double area(double); double diameter(double); void displayresult(double,double,double,double); int main() { double x1,x2,y1,y2; double rad,perimeter,areas,dia; cout<<"Please enter center point of a circle :"; cin>>x1>>y1; cout<<"Please enter a point on a circle :"; cin>>x2>>y2; rad=radian(rad); perimeter=circumferences(perimeter); areas=area(areas); displayresult(rad,perimeter,areas,dia); system("pause"); return 0; } /*double getinput() { double x1,x2,y1,y2; cout<<"Please enter center point of a circle "; cin>>x1>>y1; cout<<"Please enter a point on a circle "; cin>>x2>>y2; }*/ double distance(double …

Member Avatar
+0 forum 6
Member Avatar

For homework, we have to find the time complexity class of certain algorithms and explain why it has that certain complexity class. So, I have a couple of questions: - Why is the first running time always so much longer than the ones after? (setting up the application or something??) - What is the complexity class of an algorithm that draws a square of side length n, like this one: c.drawRect(0,0,n,n); why is it that way? - What is the complexity class of an algorithm that draws a circle of diameter n, like this: c.drawOval(0, 0, n, n); why is …

Member Avatar
+0 forum 3
Member Avatar

Python programming can have its lighter moments. Here we use one of those moments to draw an optical illusion using the Tkinter canvas to draw a rectangle, some lines and circles.

+2 forum 0
Member Avatar

I tried to create 10 random circles with random colors using windows forms. The problem am not able to restrict my program to draw only 10 circles.It goes on and on. [code] Timer t = new Timer(); t.Interval = 1; t.Start(); t.Tick += new EventHandler(DrawCircle); [/code] is there any way to stop the timer after 10 counts? So that i will call t.stop(); after drawing 10 circles.

Member Avatar
+0 forum 1

The End.