2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 #include
#include<graphics.h>
#include<conio.h>
main()
{
int gd=DETECT,gm;
setcolor(RED);
rectangle(X1,Y1,X1,Y1);
getch();
return 0;
}
Where X1, Y1, X2 , Y2 represent the width and length of the rectangle. You must also make this in a project, and download the graphics.h file.
C++ has no generic graphics capability whatsoever. Graphics are platform-specific, and every C++ implementation provides its own API and libraries specific to the intended platform. For instance, the following user-defined Visual C++ MFC function will centre any text (t) within a given rectangle (r) relative to the given device context (dc): void centre_text(CString& t, CRect& r, CDC& dc) { CRect b; // bounding rectangle. // Calculate the bounding rectangle of the text: dc.DrawText( t, b, DT_CALCRECT ); // Position the bounding rectangle in the centre of the given rectangle: b.MoveToXY( r.left + (( r.Width() - b.Width() ) / 2 ), r.top + (( r.Height() - b.Height() ) / 2 )); // Draw the text in the bounding rectangle: dc.DrawText( t, b, DT_NOCLIP ); } Note that the above code is non-generic and therefore cannot be ported to other platforms. It will only work in Visual C++ MFC applications. However, the principal will be largely the same on other platforms: calculate the bounding rectangle, move it to the centre of the intended rectangle and then print the text in the bounding rectangle.
You will have to use "printf" when you want to print two slashes one after another in c.
Copyright
printf ("initials");
2. Write a program using switch statement that reads a character representing a geometrical figure, then asks the user to enter the required data (ex. Radius for a circle, length and height for a rectangle, etc. ...) . The program should then print the area and circumference.Figures are: circle(c), square(s), rectangle(r), triangle (t).
PRINT "Give me the rectangle's length.": Input L PRINT "Give me the rectangle's width.": Input W PRINT "The rectangle's area is "; L x W PRINT "The rectangle's perimeter is "; 2 x (L + W) PRINT "You've been a great audience. I'm here til Thursday. Don't forget to tip your waiter. Have a nice day."
C++ has no generic graphics capability whatsoever. Graphics are platform-specific, and every C++ implementation provides its own API and libraries specific to the intended platform. For instance, the following user-defined Visual C++ MFC function will centre any text (t) within a given rectangle (r) relative to the given device context (dc): void centre_text(CString& t, CRect& r, CDC& dc) { CRect b; // bounding rectangle. // Calculate the bounding rectangle of the text: dc.DrawText( t, b, DT_CALCRECT ); // Position the bounding rectangle in the centre of the given rectangle: b.MoveToXY( r.left + (( r.Width() - b.Width() ) / 2 ), r.top + (( r.Height() - b.Height() ) / 2 )); // Draw the text in the bounding rectangle: dc.DrawText( t, b, DT_NOCLIP ); } Note that the above code is non-generic and therefore cannot be ported to other platforms. It will only work in Visual C++ MFC applications. However, the principal will be largely the same on other platforms: calculate the bounding rectangle, move it to the centre of the intended rectangle and then print the text in the bounding rectangle.
a rectangle. it has four parallel sides each side is the same length as the one on the other side.
C++ has no print option. The print option in your IDE allows you to print your C++ source code, thus giving you a "hard" copy of your code.
A rectangle (or square).
A C-print or Type C-print is a color print from a color negative. The term "Type C" is generally used to distinguish from R or Reversal prints or direct positive prints from transparencies (color positives). Type C prints can also be made digitally. Type C is probably the most common form of color print.
d. rectangle
write a c++ programe to print a triangle without (for)
printf(format_string, ...);
# include<stdio.h> main() { int a,b,c; print f("enter the values of a,b,c"); scan f("%d%d%d",&a,&b,&c); if((a>b)&&(a>c)) print f("Greatest value is a =%d",a); else if((b>a)&&(b>c)) print f("Greatest value is b=%d",b); else print f("Greatest value is c=%d",c); }
You will have to use "printf" when you want to print two slashes one after another in c.
Find the dimensions of the rectangle of largest area that can be inscribed in a circle of radius a in C programming