i have an assignment where i have to draw a teapot using triangles, and are struggling with the part where i have to color it. Here is an link to the assignment URl....
I have managed to draw the teapot and translated it onto the screen. the part i need support with is making a bounding box for the triangle and coloring it.
So in class our teacher assigned us a program where we have to use nested for loops to creates triangles. How does the 2nd for loop print more than 1 star? since the for loop will only run the cout 1 time until it gets to the escape sequence, how does it print more than 1 star on a line? this is what is confusing me. I feel like if i can grasp the understanding of that and what the for loops are doing i can finish the rest of this program with ease
#include<iostream> using namespace std; int main()
I have to Write a program to produce that makes four triangles and a pyramid. I have to ask the user they height of the triangle and prevent the user from entering a height any larger than 25. It should look like this.
Enter the height of your triangle/pyramid: 3
*** ** *
* ** ***
* ** ***
*** ** *
* *** *****
im having tourble with 3 and 4th and also pyramid.
HERES WHAT I HAVE SO FAR.
#include <iostream> #include <iomanip> #include <string> using namespace std; int main () { int input = 0; cout << "Please enter the height of your triangle/pyramid: ";
The program takes as input a pair of triangles, specified be giving the coordinates of each trangle's vertices. It then determines if either triangle is "nested" within the other, meaning that one triangle lies entirely within the interior of the other.
Pseudocode:
One triangle lies within another if and only if all three vertices of the first triangle lie within the interior of the second triangle.
Suppose that we have a triangle with vertices A, B, and C, described by the coordinates (xA, yA), (xB, yB), and (xC, yC), respectively. The sides of the triangle are the line segments AB, BC, and CA.
A line passing through two points (x1, y1) and (x2, y2) can be considered to be the set of points (x,y) satisfying the equation
f(x,y) = 0 where f(x,y) is given as f(x,y) = (x - x1) (y2 - y1) - (y - y1) (x2 - x1)
One of the interesting things about that f(x,y) is that we can use it to determine which "side" of the line an abitrary point (x,y) is on:
If f(x,y) = 0, the point is exactly on the line. All points for which f(x,y) > 0 are on one side of the line, and All points for which f(x,y) < 0 are on the other side So the problem of determining whether a point (x,y) is on the inside of a trangle can be checking the sign of f(x,y) for each of the three lines making up the triangle. A complicating factor is that we don't know, for any given triangle, whether those three signs should be all positive, all negative, or some mixture of the two.
The centroid of a triangle can be computed as the "average" of the x and y coordinates of the vertices:
xcen = (xA + xB + xC)/3 ycen = (yA + yB + yC)/3
This point (xcen, ycen) is definitely inside the trangle (unless the triangle is "degenerate" and has no interior points). The problem of determining whether (x,y) is on the inside of a triangle can therefore be resolved by checking to see if it is on the same side of each of the trangle's line segments as (xcen, ycen).
What I need:
I want to fill in the missing bodies for the functions eval and areOnSameSideOf, which manipulate line segments. I think calling eval from within areOnSameSideOf will simplify the implementation of the latter.
The program takes as input a pair of triangles, specified be giving the coordinates of each trangle's vertices. It then determines if either triangle is "nested" within the other, meaning that one triangle lies entirely within the interior of the other.
Pseudocode:
One triangle lies within another if and only if all three vertices of the first triangle lie within the interior of the second triangle.Suppose that we have a triangle with vertices A, B, and C, described by the coordinates (xA, yA), (xB, yB), and (xC, yC), respectively. The sides of the triangle are the line segments AB, BC, and CA.A line passing through two points (x1, y1) and (x2, y2) can be considered to be the set of points (x,y) satisfying the equation
f(x,y) = 0 where f(x,y) is given as f(x,y) = (x - x1) (y2 - y1) - (y - y1) (x2 - x1)
One of the interesting things about that f(x,y) is that we can use it to determine which "side" of the line an abitrary point (x,y) is on:
If f(x,y) = 0, the point is exactly on the line.
All points for which f(x,y) > 0 are on one side of the line, and All points for which f(x,y) < 0 are on the other side So the problem of determining whether a point (x,y) is on the inside of a trangle can be checking the sign of f(x,y) for each of the three lines making up the triangle.
A complicating factor is that we don't know, for any given triangle, whether those three signs should be all positive, all negative, or some mixture of the two.
The centroid of a triangle can be computed as the "average" of the x and y coordinates of the vertices:
xcen = (xA + xB + xC)/3 ycen = (yA + yB + yC)/3
This point (xcen, ycen) is definitely inside the trangle (unless the triangle is "degenerate" and has no interior points).
The problem of determining whether (x,y) is on the inside of a triangle can therefore be resolved by checking to see if it is on the same side of each of the trangle's line segments as (xcen, ycen).
I want to fill in the missing bodies for the functions eval and areOnSameSideOf, which manipulate line segments. I think calling eval from within areOnSameSideOf will simplify the implementation of the latter.
Code: #include <iostream> using namespace std; /** * 2D Cartesian coordinates */ struct Point { double x; double y;
Here's my game, what do I need to learn to make a basic GUI? (Easiest way possible for now).
--NOTE, the code was a bit too long for me to post. I can add it if it is necessary. Basically all I want are 4 buttons on the main screen, one that says "Arena," "Store," "Stats," and "Exit."
There will of course be sub menus to each option, but we will get to that later.
I have project that is on c++. it runs fine. i want to use it in my C# application as a dll. i have created its dll and but firing exception of "interprocess communication".
Is this a doable task that creating dll of an exe project and using it in C# application?
I am trying to get this to work without arrays. At the moment all I am trying to do is allow it so that when the user presses 1 the board prints with 1 replaced by X, tell me where am i going wrong. I know its not finished.
#include <stdio.h> #include <stdbool.h> char a = '1'; char b = '2'; char c = '3';
So basically I have to write a C program that, when opening the html file in a browser, looks essentially like this: (Size, position, color of the shapes doesn't matter so long as I have one of each shape and the box surrounding them. Words up top dont matter either.)
This is what I have so far: Code: #include <stdio.h> #include <stdlib.h> #define FILENAME ("A4P1.html") [code]....
Anyways i can get the individual shapes, but I don't know how to get all the shapes to appear at once..
I'm creating a game in which i.need player to.answer.my question within 10 seconds...
So I need a code for this timer... I don't want code to be paused by sleep or delay functions.. But I need that it waits.for 10 seconds.. and if user types answer in between.. it.reads it
And if player.doesn't answers it within 10 sec.. it displays a message
I wish to create a simple animation, similar to the pong game but completely automatic (i.e. both sides play against eachother sort of like in a screensaver of sorts).
I am clueless on to even start tackling this, what tools to use and how to use them, to make them do what I want. I have had some experience with C++ scripting while modding Fallout 3, but I'm not sure how similar the scripting system available in the SDK for that game, is to the real thing.
Like I was saying I want to create a simple animation where two AI blocks try to prevent a ball from reaching the wall behind them.
What my ultimate goal here is to make a program that asks the user how many numbers they would like to add followed by asking the user what numbers they want to add. I want the amount of numbers they can add to be infinite and have the loop continue adding the numbers until it reaches the final number. I just need to know how to do this.
Here's my code:
#include <iostream> #include <string> using namespace std; int main() { //variables int amount; float num; float sum;
I'm trying to write a code that proves a queue like fifo (first in first out). I have four characters :
p(rint),e(nqueue),d(equeue) and q(uit).
The problem is when I press d a first character must get rid of, but not. When I press d the numbers get double.
Example input: e 2 3 9 8 7 p 2 3 9 8 7 d p 3 9 8 7 d p 9 8 7
#include <stdio.h> void enqueue(int queue[], int newnum, int *tail_p, int maxsize); void deque(int queue[], int *tail_p, int *elem); void printqueue(int queue[],int count);
I have a problem with making header files in c, i get the code written only in main.c and then i have to create a files with extension .h and extension .c but how to do it.
I have a 2D array, array[20][3]. Each row represents a storm and each column represents month #, wind speed, and pressure in that order. This data is read from a file and auto-fills the array. I need to be able to give users the ability to add an additional storm or delete a storm. I know that a linked list would be the best approach but I'm not very familiar with linked lists.