Question

In: Computer Science

Write C++ mathematics program that a Given an arc with its center at zero, and the...

Write C++ mathematics program that a Given an arc with its center at zero, and the arc should be user defined in 3D-space by means of a 3x3 transformation matrix, and a radius, start-angle and sweep-angle should be user defined. it gives output/tells the most extreme XY points that arc goes to

The radius,start angle and sweep angle should be user defined.

make the code quickly and send me

sir the matrix should always be 3x3 center is at zero initially
and raduis,start angle and sweep angle should be user defined
The program should calculate extreme points values of arc
initially assume any assumptions if u don't find sufficient info kindly solve and send me

Solutions

Expert Solution

In this program , I have used the arc() function in the graphics library to generate the arc which accepts following parameters:
arc(x,y,start,end,radius)

Where: x,y are coordinates of the centre

                start is the staring angle of the arc

                end is the ending angle of the arc

                radius is the radius of the arc

Rest all explanations are there in the code itself as comments, wherever required.

CODE:

#include<bits/stdc++.h>
#include <graphics.h>
using namespace std;

int main()

{

// gm is Graphics mode which is a computer display mode that generates image using pixels.
// DETECT is a macro defined in "graphics.h" header file

int gd = DETECT, gm;
   float x,y;
   float start,end;
   float radius;
  
// Getting input for the location of the arc from user
   cout<<"Enter the starting point of the arc.\n";
   cin>>x>>y;
  

// Getting input the start and end angle from user
  
  
    cout<<"Enter the staring and end angle.\n";
cin>>start>>end;

// Getting the radius of the arc as input

   cout<<"Enter the radius of the arc.\n";
   cin>>radius;
  

// The initgraph function initializes the graphics system by loading a graphics driver from disk

initgraph(&gd, &gm, "");

// Calling the arc function to generate the arc

arc(x, y, start, end, radius);


// This closegraph function closes the graphics mode and deallocates all memory allocated by graphics system

closegraph();

return 0;

}

Hope it helps you.

Please provide a review if you find it helpful.

Thanks! :)


Related Solutions

write a program on c++ that outputs a calendar for a given month in a given...
write a program on c++ that outputs a calendar for a given month in a given year, given the day of the week on which the 1st of the month was. The information in numeric format (months are: 1=Januay, 2=February 3=March, 4= April, 5= May, 6= June, 7= July... etc days are 1=Sunday, 2=Monday, 3= Tuesday, 4= Wednesday, 5= Thursday, 6= Friday and 7= Saturday ). The program output that month’s calendar, followed by a sentence indicating on which day...
Using C++. Write a program to input marks of five subjects Physics, Chemistry, Biology, Mathematics and...
Using C++. Write a program to input marks of five subjects Physics, Chemistry, Biology, Mathematics and Computer. The input marks must be inserted one subject at a time. The program then calculate percentage and grade according to given conditions: If percentage >= 90% : Grade A If percentage >= 80% : Grade B If percentage >= 70% : Grade C If percentage >= 60% : Grade D If percentage >= 40% : Grade E If percentage < 40% : Grade...
write a program in c++ that opens a file, that will be given to you and...
write a program in c++ that opens a file, that will be given to you and you will read each record. Each record is for an employee and contains First name, Last Name hours worked and hourly wage. Example; John Smith 40.3 13.78 the 40.3 is the hours worked. the 13.78 is the hourly rate. Details: the name of the file is EmployeeNameTime.txt Calculate the gross pay. If over 40 hours in the week then give them time and a...
write a program that finds the average of all positive, non-zero values found in a given...
write a program that finds the average of all positive, non-zero values found in a given array of doubles and prints that to the console. Any negative or zero values do not contribute to the average. The program should use the array provided in the code, and you may assume that it has already been populated with values. The results should be printed out to the console in the following format: “Average: ”<<average value>> Values denoted in “<< >>” represent...
Write a C# program that prints a calendar for a given year. Call this program calendar....
Write a C# program that prints a calendar for a given year. Call this program calendar. The program prompts the user for two inputs:       1) The year for which you are generating the calendar.       2) The day of the week that January first is on, you will use the following notation to set the day of the week:            0 Sunday                     1 Monday                   2 Tuesday                   3 Wednesday       4 Thursday                 5 Friday                      6 Saturday Your program should...
C program help 1. Write a program to compute the Mileage given by a vehicle. Mileage...
C program help 1. Write a program to compute the Mileage given by a vehicle. Mileage = (new_odometer – old_odometer)/(gallons_gas) // illustrating how ‘for’ loop works. 2. How to initialize an array of size 5 using an initializer list and to compute it’s sum How to initialize an array of size 5 with even numbers starting from 2 using ‘for’ loop and to compute it’s sum 3. Program to compute the car insurance premium for a person based on their...
Part1: Write a program in C/C++ to find the maximum flow in the given Flow Network...
Part1: Write a program in C/C++ to find the maximum flow in the given Flow Network using (i)Ford -Fulkerson algorithm and (ii) Edmond-Karps algorithm Go through the related text and implement each of these algorithms using the efficient data structure. Show the results of different steps of these algorithms for an instance of the flow network with total number of nodesV=6 (please note down that in a flow network there are two special nodes source and sink) and total number...
C Programming Question: Q) Write a C - program to check whether a given graph is...
C Programming Question: Q) Write a C - program to check whether a given graph is Bipartite using Breadth-first search (adjacency list) Do take your time but please do post full code and also please do it in C.
C Programming Write a program in C that reads in a file, stores its contents as...
C Programming Write a program in C that reads in a file, stores its contents as a character array/pointer (char*) into an unsigned character array/pointer (unsigned char* message). Note: the input file can have one line or multiple lines and vary in length
Write a C++ program that implements a simple scanner for a source file given as a...
Write a C++ program that implements a simple scanner for a source file given as a command-line argument. The format of the tokens is described below. You may assume that the input is syntactically correct. Optionally, your program can build a symbol table (a hash table is a good choice), which contains an entry for each token that was found in the input. When all the input has been read, your program should produce a summary report that includes a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT