I am trying to figure out how to create a program that will draw a triangle using *'s with a base the has a user-inputted number of *'s like so:
*
***
*****
It needs to take a user inputted number and draw a pyramid like the above pyramid with the number of *'s in the base matching the user inputted number (i.e., user enters 10, so the triangle has 10 *'s in the base). I figured it would be best to first create a loop to draw out the correct number of *'s before trying to create another loop to draw out the correct number of spaces, to properly align the *'s into a triangle shape.
int width = 0;
int height = 0;
int i = 0;
int leafWidth = 0;
I got the upper pattern but below pattern is not working it executes infinte loop, how to reslove this.
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ro { class ro { static void Main(string[] args) { int numberoflayer = 5, Space, Number;
Now I got rid off the white border but everytime I draw a text it write on top of the previous text so after few seconds everything is a mess and the time is no longer readable.
I am drawing in a simple (square) MFC window. I realize that (0,0) starts in the upper left hand corner. I wanted to see how MFC handled drawing of angles, so I use this code:
Code: double CompassDegreesToRadians(double compassDegrees) { return((PI / 2.0f) - (compassDegrees * PI / 180.0f)); } // Make pen CPen penRed; penRed.CreatePen(PS_SOLID | PS_COSMETIC, 1, RGB(255, 0, 0)); // Test Angles
[Code] .....
Using this code, and changing the value of angle1 to these values (0, 90, 180, 270) I think MFC uses the coordinate system:
This seems like a strange coordinate system to use. Am I doing something wrong? If this is correct, how can I convert my calculations to this coordinate system? (compass degrees):
I want to show a list of graphical items in 1 or 2 columns (user selected). I will draw the items (owner-draw). I tried many hours today to find a solution with clistctrl. Is it possible to make it with clistctrl?
The question says: Make an "analog clock" that is, a clock with hands that move. You get the time of day from the operating system through a library call. A major part of this exercise is to find the functions that give you the time of day and a way of waiting for a short period of time (e.g., a second for a clock tick) and to learn to use them based on the documentation you found. Hint: clock(), sleep().
OK, I wrote below code. It is in its primary stages and has not been completed yet.
Code: #include <GUI.h> #include <time.h> #include <iostream> using namespace Graph_lib; //--------------------------------- class Dynamic_clock : public Window {
[Code] .....
I expect the system in void clock_hands() (line 38) attaches hour1 (line 41) then waits for 1000 ms (using Sleep(1000)) then detaches hour1 and attaches hour2 this time. But it doesn't occur in practice. When the system reaches Sleep(1000); it seems to go into a comma! It doesn't show the hour1 so seeing the movement of clock ticks by the clock's hands will not be possible.
I'm having a custom control and I added a vertical scroll bar to it. After scrolling down and then up what all controls are added are disappeared. Controls added are (checkboxes, editboxes, browse button).
Scroll works fine. Looks like painting problem but unable to resolve the issue.
I want to make a custom program for packaging multiple files in one. Not as complicated as ZLIB or others. Consider few files, XML, txt, JPG, OGG, I want them to be added in 1 file. Not visible not readable. Just a datafile. I have some ideas about creating some kind of indexing of the start byte, end byte of each file. But I am still way too far. Can you point me some direction at what should I stress in creating this software. It will be portable since I am planning to use stdlib, stdio only, maybe and string to recreate the filenames from the large chunk datafile.
I'm using Visual Studio Express 2013 to create a Windows program that will upgrade my micro-controller firmware. I have a .exe program to upgrade it. What I normally do is I drag and drop a .txt file on the .exe program and it will be done. I want to write a program that will do the exact same thing. Where when I click on a button, it will run the .exe program with the .txt file.
What I got so far is just run the .exe program when i press the button. I do not know how to write a code to let the .exe start with the .txt file. Here's what I got so far.
Process.Start(@"C:UsersJayDocumentsVisual Studio 2013ProjectsWindowsFormsApplication1BSL_FilesBSL ScripterBSL_Scripter.exe");
That line only manage to open up my .exe file. How do I make it run with the .txt at this location?
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: ";
Code: 1 121 12321 1234321 123454321 EDIT: the above pyramid looks like a doom.i.e 1-5 will be in center.1-4(L)1-3(L)1-2(L)1(L) similarly 1-4(R) 1-3(R) 1-2(R) 1(R)
I'm partly successful in building the requirement of the program.but cant able to think the logic for the other half. how can i proceed.below is the code written in c#.
I'm in the beginning stages of designing my first video game using SDL, and have run into a bit of an impasse. I attempt to draw the map using a simple tile function and nothing prints to the screen. I am going to attach the function itself.
bool Tile::draw_tiles ( void ) { GV gv;
//Open the map std::ifstream map ( "test.map" ); for ( int y = 0; y < GV::MAP_HEIGHT / 64; y++ ) { for ( int x = 0; x < GV::MAP_WIDTH / 64; x++ ) {
[Code] ....
Extra notes: 1. Compiles fine. 2. No run time errors (this function returns true). 3. Apply surface is a function that takes an x and y value for position on the map, an image, a screen to print it to, and a rectangle to cut out the image out of. 4. I did some bug testing and added another function to print the image SDLS_tiles by itself (its just a simple sprite map) after the map.close() function, and it worked fine.
i have to make an application called " paint " in c++ . It should facilitate user to draw different shapes using a mouse. Now the biggest hurdle i am facing is the usage of mouse .. what is the header file for usage of mouse ? i am using visual studio 2010 . the syntax is creating problems ..
Found a good beginner's tutorial to learn Visual C++: [URL] ....
How to change the drawing so that instead of squares, the game draws circles. Can figure out that using Ellipse in the code results in circle outlines, but the fill remains as square color shapes.
The drawing code from the tutorial is below. How to substitute filled circles for filled squares.
Code:
// CSameGameView drawing void CSameGameView::OnDraw(CDC* pDC){ // First get a pointer to the document CSameGameDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if(!pDoc)
I'm doing a project and I need to draw a square into a pgm image if certain conditions are met, but I'm not sure how to draw the square into the image.
For my code, I am getting a value for lengths of x, y and z like "getXlength(x_length)" etc... I would like to know how I can use these values to draw the prism rather than giving values for each coordinates in each face.