answersLogoWhite

0

📱

C Programming

Questions related to the C Computer Programming Language. This ranges all the way from K&R to the most recent ANSI incarnations. C has become one of the most popular languages today, and has been used to write all sorts of things for nearly all of the modern operating systems and applications. It it a good compromise between speed, power, and complexity.

9,649 Questions

Write a program to represent a deck of playing cards using arrays?

1

2

3

4

5

6

7

8

9

10

//DeckOfCards.h class Deckofcards { public: Deckofcards(); void shuffle(); void deal(); private: int deck[4][13]; };

1

2

3

4

5

6

7

8

9

10

11

//client.cpp #include "DeckOfCards.h" int main() { Deckofcards deckofcards; deckofcards.shuffle(); deckofcards.deal(); return 0; }//end main

1

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

//Deckofcards.cpp #include <iostream> using std::cout; using std::left; using std::right; #include <iomanip> using std::setw; #include <cstdlib> using std::rand; using std::srand; #include <ctime> using std::time; #include "DeckOfCards.h" Deckofcards::Deckofcards() { for (int row = 0; row <= 3; row++ ) { for (int column = 0; row <= 12; column++) { deck[row][column] = 0; //slot of deck is 0 }//end column for }//end row for srand(time(0));//seed random number }//end Deckofcards constructor void Deckofcards::shuffle() { cout << "hit"; int row; //suit of card int column; //face of card for (int card = 1; card <=52; card++) { do { row = rand()%4; column = rand()%13; } while( deck[row][column] !=0);//end do...while deck [row][column] = card; }//end for }//end shuffle void Deckofcards::deal() { cout << "hit"; static const char *suit[4] = {"Hearts", "Diamonds", "Clovers", "Spades"}; static const char *face[13] = {"Ace", "Deuce", "Three", "Four", "Five", "Six", "Seven" , "Eight", "Nine", "Ten", "Jack", "Queen", "King" }; for (int card = 1; card <=52; card++) { for (int row = 0; row <= 3; row++) { for (int column = 0; column <= 12; column++) { if (deck[row][column] == card) { cout << setw(5) << right << face[column] << " of " << setw(8) << left << suit[row] << (card %2 == 0 ? '\n' : '\t'); }//end if }//end for }//end for }//end for }//end deal

What are arrow loops?

an arrow loop is a slit or hole used to shoot arrows through.

Write a program to create tajmahal?

#include<graphics.h>

#include<conio.h>

#include<dos.h>

#include<stdlib.h>

#include<process.h> main()

{

int gd=DETECT,gm;

initgraph(&gd,&gm,"c:\tc\bgi");

int h=40;

line(0,440,639,440); //line(20,30+h,619,30+h); //line(25,400,38,120);

//line(85,400,78,120);

//line(85,400,78,120);

//=================================Ist tower========================//

//=================================IIst

tower============================//

//#################TOWER%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%//

int l=-20;

line(28+l,400+h,33+l,333+h);

line(86+l,400+h,80+l,333+h);

//Ist

stage//

line(23+l,328+h,32+l,334+h); // slant

line(88+l,328+h,80+l,334+h); // slant

line(83+l,323+h,75+l,334+h); // slant

line(75+l,323+h,70+l,332+h);

line(66+l,323+h,65+l,332+h); // slant

line(57+l,323+h,57+l,332+h); // slant

line(30+l,323+h,39+l,334+h); // slant

line(38+l,323+h,45+l,332+h);

line(48+l,323+h,51+l,332+h); // slant ellipse(57+l,320+h,350,190,34,5);

ellipse(57+l,327+h,350,190,34,5);

ellipse(57+l,337+h,0,180,25,5);

line(22+l,320+h,22+l,328+h);

line(91+l,320+h,91+l,327+h);

setfillstyle(6,15);

floodfill(60+l,320+h,15); setfillstyle(10,15); floodfill(60+l,320+h+15,15);

//

//

//+++++++++++++++++++++++++++++++++++2nd+++++++++++++++++++++++++++ line(35+l,315+h,38+l,242+h);

line(80+l,315+h,75+l,242+h); //2st

stage//

int t=-93;

line(23+4+l,328+t+3+h,32+5+l,334+t+h); // slant

line(88+l,328+t+2+h,76+l,334+t+h); // slant

//line(+l83,323+t+4,75,334+t); // slant

line(78+l,323+t+3+h,71+l,332+t+h);

line(66+l,323+t+2+h,65+l,332+t+h); // slant

line(57+l,323+t+2+h,57+l,332+t-2+h); // slant

//line(30,323+t+2,39,334+t); // slant

line(35+l,323+t+3+h,45-3+l,332+t+h);

line(48+l,323+t+2+h,51+l,332+t-2+h); // slant ellipse(57+l,320+t+3+h,360,190,30,5);

ellipse(57+l,327+t+3+h,360,190,30,5);

ellipse(57+l,337+t-1+h,0,180,18,5); line(26+l,320+t+3+h,26+l,328+t+2+h);

line(88+l,320+t+3+h,88+l,327+t+3+h);

//

|//

setfillstyle(6,15);

floodfill(60+l,320+h+t,15); ////////////////

setfillstyle(10,15);

floodfill(60+l,320+h-35,15); //3rd

stage// line(38+l,225+h,41+l,152+h);

line(75+l,225+h,72+l,152+h); t=-182;

line(32+l,328+t+4+h,32+7+l,334+t+h); // slant

line(80+l,328+t+4+h,73+l,334+t+h); // slant

//line(+l83,323+t+4,75,334+t); // slant

line(76+l,323+t+5+h,71+l,332+t+h);

line(66+l,323+t+4+h,65+l,332+t+h); // slant

line(57+l,323+t+4+h,57+l,332+t-2+h); // slant

//line(30,323+t+2,39,334+t); // slant

line(39+l,323+t+6+h,45+l,332+t+1+h);

line(48+l,323+t+4+h,51+l,332+t+h); // slant ellipse(57+l,320+t+6+h,360,190,24,5);

ellipse(57+l,327+t+4+h,360,190,24,5);

ellipse(57+l,337+t-1+h,0,170,16,5); line(32+l,320+t+6+h,32+l,328+t+3+h);

line(81+l,320+t+6+h,81+l,327+t+3+h); setfillstyle(6,15);

floodfill(60+l,322+h+t,15);

//

//

setfillstyle(10,15);

floodfill(60+l,322+h+t+30,15);

//GGF################TOWER%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%// ellipse(51+l,132+h,340,216,4,15);

ellipse(62+l,131+h,327,216,4,15);

ellipse(72+l,132+h,327,216,2,15);

ellipse(42+l,132+h,327,216,2,15);

ellipse(57+l,107+h,0,170,16,5);

line(40+l,107+h,40+l,140+h);

line(75+l,107+h,75+l,140+h); line(34+l,107+h,40+l,107+h);

line(75+l,107+h,81+l,107+h); line(34+l,107+h,28+l,102+h); //slant

line(81+l,107+h,87+l,102+h); line(28+l,102+h,34+l,98+h);

line(87+l,102+h,81+l,98+h); line(34+l,98+h,58+l,95+h);

line(58+l,95+h,81+l,98+h);

ellipse(65+l,92+h,104,190,30,30); ellipse(50+l,92+h,350,76,30,30); line(58+l,61+h,58+l,63+h);

circle(58+l,58+h,3);

line(58+l,55+h,58+l,53+h);

circle(58+l,50+h,2);

line(58+l,48+h,58+l,47+h);

circle(58+l,45+h,1);

line(58+l,44+h,58+l,41+h);

setfillstyle(6,15);

floodfill(60+l-2,322+h+t-60,15); setfillstyle(10,15);

floodfill(60+l-2,322+h+t-30,15);

//=================================IIst

tower============================//

//#################TOWER%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%//

l=547;

line(28+l,400+h,33+l,333+h);

line(86+l,400+h,80+l,333+h);

//Ist

stage//

line(23+l,328+h,32+l,334+h); // slant

line(88+l,328+h,80+l,334+h); // slant

line(83+l,323+h,75+l,334+h); // slant

line(75+l,323+h,70+l,332+h);

line(66+l,323+h,65+l,332+h); // slant

line(57+l,323+h,57+l,332+h); // slant

line(30+l,323+h,39+l,334+h); // slant

line(38+l,323+h,45+l,332+h);

line(48+l,323+h,51+l,332+h); // slant ellipse(57+l,320+h,350,190,34,5);

ellipse(57+l,327+h,350,190,34,5);

ellipse(57+l,337+h,0,180,25,5);

line(22+l,320+h,22+l,328+h);

line(91+l,320+h,91+l,327+h);

setfillstyle(6,15);

floodfill(60+l,320+h,15); setfillstyle(10,15); floodfill(60+l,320+h+15,15);

//

//

//+++++++++++++++++++++++++++++++++++2nd+++++++++++++++++++++++++++ line(35+l,315+h,38+l,242+h);

line(80+l,315+h,75+l,242+h); //2st

stage//

t=-93;

line(23+4+l,328+t+3+h,32+5+l,334+t+h); // slant

line(88+l,328+t+2+h,76+l,334+t+h); // slant

//line(+l83,323+t+4,75,334+t); // slant

line(78+l,323+t+3+h,71+l,332+t+h);

line(66+l,323+t+2+h,65+l,332+t+h); // slant

line(57+l,323+t+2+h,57+l,332+t-2+h); // slant

//line(30,323+t+2,39,334+t); // slant

line(35+l,323+t+3+h,45-3+l,332+t+h);

line(48+l,323+t+2+h,51+l,332+t-2+h); // slant ellipse(57+l,320+t+3+h,360,190,30,5);

ellipse(57+l,327+t+3+h,360,190,30,5);

ellipse(57+l,337+t-1+h,0,180,18,5); line(26+l,320+t+3+h,26+l,328+t+2+h);

line(88+l,320+t+3+h,88+l,327+t+3+h);

//

//

setfillstyle(6,15);

floodfill(60+l,320+h+t,15); ////////////////

setfillstyle(10,15);

floodfill(60+l,320+h-35,15); //3rd

stage// line(38+l,225+h,41+l,152+h);

line(75+l,225+h,72+l,152+h); t=-182;

line(32+l,328+t+4+h,32+7+l,334+t+h); // slant

line(80+l,328+t+4+h,73+l,334+t+h); // slant

//line(+l83,323+t+4,75,334+t); // slant

line(76+l,323+t+5+h,71+l,332+t+h);

line(66+l,323+t+4+h,65+l,332+t+h); // slant

line(57+l,323+t+4+h,57+l,332+t-2+h); // slant

//line(30,323+t+2,39,334+t); // slant

line(39+l,323+t+6+h,45+l,332+t+1+h);

line(48+l,323+t+4+h,51+l,332+t+h); // slant ellipse(57+l,320+t+6+h,360,190,24,5);

ellipse(57+l,327+t+4+h,360,190,24,5);

ellipse(57+l,337+t-1+h,0,170,16,5); line(32+l,320+t+6+h,32+l,328+t+3+h);

line(81+l,320+t+6+h,81+l,327+t+3+h); setfillstyle(6,15);

floodfill(60+l,322+h+t,15);

//

//

setfillstyle(10,15);

floodfill(60+l,322+h+t+30,15);

//GGF################TOWER%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%// ellipse(51+l,132+h,340,216,4,15);

ellipse(62+l,131+h,327,216,4,15);

ellipse(72+l,132+h,327,216,2,15);

ellipse(42+l,132+h,327,216,2,15);

ellipse(57+l,107+h,0,170,16,5);

line(40+l,107+h,40+l,140+h);

line(75+l,107+h,75+l,140+h); line(34+l,107+h,40+l,107+h);

line(75+l,107+h,81+l,107+h); line(34+l,107+h,28+l,102+h); //slant

line(81+l,107+h,87+l,102+h); line(28+l,102+h,34+l,98+h);

line(87+l,102+h,81+l,98+h); line(34+l,98+h,58+l,95+h);

line(58+l,95+h,81+l,98+h);

ellipse(65+l,92+h,104,190,30,30); ellipse(50+l,92+h,350,76,30,30); line(58+l,61+h,58+l,63+h);

circle(58+l,58+h,3);

line(58+l,55+h,58+l,53+h);

circle(58+l,50+h,2);

line(58+l,48+h,58+l,47+h);

circle(58+l,45+h,1);

line(58+l,44+h,58+l,41+h);

setfillstyle(6,15);

floodfill(60+l-2,322+h+t-60,15); setfillstyle(10,15);

floodfill(60+l-2,322+h+t-30,15);

//

// //GGF################TOWER%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%// ellipse(51+l,132+h,340,216,4,15);

ellipse(62+l,131+h,327,216,4,15);

ellipse(72+l,132+h,327,216,2,15);

ellipse(42+l,132+h,327,216,2,15);

ellipse(57+l,107+h,0,170,16,5);

line(40+l,107+h,40+l,140+h);

line(75+l,107+h,75+l,140+h); line(34+l,107+h,40+l,107+h);

line(75+l,107+h,81+l,107+h); line(34+l,107+h,28+l,102+h); //slant

line(81+l,107+h,87+l,102+h); line(28+l,102+h,34+l,98+h);

line(87+l,102+h,81+l,98+h); line(34+l,98+h,58+l,95+h);

line(58+l,95+h,81+l,98+h);

ellipse(65+l,92+h,104,190,30,30); ellipse(50+l,92+h,350,76,30,30); line(58+l,61+h,58+l,63+h);

circle(58+l,58+h,3);

line(58+l,55+h,58+l,53+h);

circle(58+l,50+h,2);

line(58+l,48+h,58+l,47+h);

circle(58+l,45+h,1);

line(58+l,44+h,58+l,41+h);

//=================================Ist tower========================// //+++++++++++++++++++++++++++++++++TAJ mahal++++++++++++++++++++++++// ////setcolor(15); rectangle(275,290,365,440); // inner

rectangle(268,283,372,440); // //inner

setfillstyle(1,15);

floodfill(274,294,15);

line(280,440,280,350);

//line(283,440,283,350);

ellipse(315,349,130,180,35,40);

ellipse(275,280,290,326,53,40); line(360,440,360,350);

ellipse(325,349,360,50,35,40);

ellipse(361,280,216,255,53,40);

setfillstyle(9,7);

floodfill(277,386,15);

putpixel(277,386,14); line(280,360,359,360);

line(280,364,359,364);

setfillstyle(1,15);

floodfill(281,362,15); rectangle(295+4,370,345-4,440);

rectangle(292+4,367,348-4,440);

setfillstyle(1,15);

floodfill(294+4,369,15);

rectangle(296,378,344,380);

floodfill(301,379,15);

line(302,405,302,440);

line(338,405,338,440);

ellipse(327,405,108,180,25,20); ellipse(313,405,360,74,25,20); setfillstyle(7,15);

//putpixel(312,416,11);

//floodfill(312,406,15);

line(329,390,329,440);

line(310,391,310,440);

line(311,402,329,402);

line(311,422,329,422);

line(302,412,310,412);

line(329,412,338,412); line(302,428,310,428);

line(329,428,338,428);

//setfillstyle(7,15);

int p=-60;

line(302,405+p,302,440+p-20);

line(338,405+p,338,440+p-20);

ellipse(327,405+p,108,180,25,20); ellipse(313,405+p,360,74,25,20);

setfillstyle(7,15);

floodfill(311,406,15);

line(329,390+p,329,440+p-20);

line(310,391+p,310,440+p-20);

line(311,402+p,329,402+p);

line(311,422+p-7,329,422+p-7);

line(302,412+p,310,412+p);

line(329,412+p,338,412+p); //??//////////////////////////////////2nd portion/////////////////////

rectangle(245,260,400,440); // inner

rectangle(230,245,415,440); // //inner rectangle(230,425,275,440);

setfillstyle(1,15);

floodfill(231,426,15);

floodfill(249,426,15);

////setcolor(8);

rectangle(230+135,425,275+140,440);

//setfillstyle(1,15); floodfill(231+160,426,15);

floodfill(249+159,426,15); ////setcolor(15);

line(415,290,415,440);

line(420,245,420,440); line(415,240,415,205);

line(420,240,420,205);

line(225,245,225,440); //vertical

line(230,250,230,440); line(225,240,225,205); //vertical

line(230,240,230,205); line(222,240,425,240);

line(222,245,425,245); //horz ellipse(222,242.5,90,270,2.5,2.5);

ellipse(425,242.5,270,90,2.5,2.5); rectangle(231,230,414,239); ellipse(227,206,0,180,9,1);

ellipse(227,204,0,180,9,1);

putpixel(220,204,15);

putpixel(220,205,15);

putpixel(220,206,15);

putpixel(235,204,15);

putpixel(235,205,15);

putpixel(235,206,15);

ellipse(227,203,0,180,6,7);

line(227,195,227,192);

int r=190; ellipse(227+r,206,0,180,9,1);

ellipse(227+r,204,0,180,9,1);

putpixel(220+r,204,15);

putpixel(220+r,205,15);

putpixel(220+r,206,15);

putpixel(235+r,204,15);

putpixel(235+r,205,15);

putpixel(235+r,206,15); ellipse(227+r,203,0,180,6,7);

line(227+r,195,227+r,192); /* //floodfill(305,424,15);

//floodfill(305,429,15);

//floodfill(325,424,15);

//floodfill(325,421,15);

//floodfill(332,420,15);

//floodfill(332,429,15);

*/ ellipse(315,170,140,210,105,100);

ellipse(330,170,330,40,105,100); ellipse(292,167,105,140,75,95);

ellipse(353,167,40,75,75,95); ellipse(323,78,350,190,60,8);

ellipse(323,77,350,190,60,8);

//ellipse(259,24,295,358,58,51);

ellipse(240,24,321,358,78,71);

ellipse(192,40,342,7,128,100); ellipse(448,30,180,203,128,100);

ellipse(443,5,194,220,128,100);

ellipse(438,-9,203,234,128,100);

ellipse(198,-6,310,340,128,100); ellipse(319,30,0,360,7,2); floodfill(320,29,15);

circle(319,24,3);

line(319,20,319,18);

circle(319,14,4);

line(319,9,319,0);

//ellipse(319,4,0,360,2,3);

circle(319,2,1);

line(316,6,322,6);

line(316,6,314,4);

line(322,6,324,4);

//??????????????????????????????????? //////////////////////////////////////////////////////////

//ellipse();

ellipse(321,258,48,130,140,50);

ellipse(321,255,48,130,140,50); ellipse(321,241,48,130,140,50);

ellipse(321,238,48,130,140,50);

//setfillstyle(6,11);

// line(265,79,277,70);

//////setcolor(4);

//line(385,81,380,76); //while(!kbhit())

//{

delay(300);

setfillstyle(10,15); floodfill(322,160,15);

setfillstyle(6,15); floodfill(322,193,15); //}

//line(319,26,319,480+h);//center ///////////////////////////////////////////new////////////////////////////

rectangle(150,283,225,294); //line(146,294,225,294);

line(150,298,225,298); line(150,240,150,440); //pole

line(146,240,146,440); line(150,299,150,440); //pole

line(146,299,146,440);

r=-80;

int n=34; ellipse(227+r,206+n,0,180,9,1);

ellipse(227+r,204+n,0,180,9,1);

putpixel(220+r,204+n,15);

putpixel(220+r,205+n,15);

putpixel(220+r,206+n,15);

putpixel(235+r,204+n,15);

putpixel(235+r,205+n,15);

putpixel(235+r,206+n,15); ellipse(227+r,203+n,0,180,6,7);

line(227+r,195+n,227+r,192+n); l=128;

h=150; ellipse(51+l,132+h-7,340,216,4,15);

ellipse(62+l,131+h-7,327,216,4,15);

ellipse(72+l,132+h-7,327,216,2,15);

ellipse(42+l,132+h-7,327,216,2,15);

ellipse(57+l,107+h,0,170,16,5);

line(40+l,107+h,40+l,140+h-7);

line(75+l,107+h,75+l,140+h-7); line(34+l,107+h,40+l,107+h);

line(75+l,107+h,81+l,107+h); line(34+l,107+h,28+l,102+h); //slant

line(81+l,107+h,87+l,102+h); line(28+l,102+h,34+l,98+h);

line(87+l,102+h,81+l,98+h); line(34+l,98+h,58+l,95+h);

line(58+l,95+h,81+l,98+h);

ellipse(65+l,92+h,104,190,30,30); ellipse(50+l,92+h,350,76,30,30); line(58+l,61+h,58+l,63+h);

circle(58+l,58+h,3);

line(58+l,55+h,58+l,53+h);

circle(58+l,50+h,2);

line(58+l,48+h,58+l,47+h);

circle(58+l,45+h,1);

line(58+l,44+h,58+l,41+h);

line(100-5,240+15,100-5,440); //pole

line(96-5,240+15,96-5,440); r=-134;

n=49;

ellipse(227+r,206+n,0,180,9,1);

ellipse(227+r,204+n,0,180,9,1);

putpixel(220+r,204+n,15);

putpixel(220+r,205+n,15);

putpixel(220+r,206+n,15);

putpixel(235+r,204+n,15);

putpixel(235+r,205+n,15);

putpixel(235+r,206+n,15); ellipse(227+r,203+n,0,180,6,7);

line(227+r,195+n,227+r,192+n);

line(146,294,97,302);

line(146,298,97,306); line(146,283,97,291);

///////////////////////////////////////inner///////////////// //rectangle(275+k,290,365+k,440); // inner

//rectangle(268+k,283,372+k,440); // //inner //line(225,367,151,367);

rectangle(155,302,220,364);

rectangle(155,302+70,220,364+75); int q=-133;

int d=-2;

line(302+q-5,405+d,302+q-5,440+d);

line(338+q+5,405+d,338+q+5,440+d);

ellipse(327+q+5,405+d,108,180,35,30); ellipse(313+q-5,406+d,360,74,35,30);

d=-77;

line(302+q-5,405+d,302+q-5,440+d);

line(338+q+5,405+d,338+q+5,440+d);

ellipse(327+q,405+d,105,180,30,25); ellipse(313+q,405+d,360,80,30,25);

putpixel(163,300,11);

setfillstyle(6,15);

floodfill(163,330,15);

floodfill(160,380,15); line(141,305,141,360);

line(101,310,101,365);

line(141,305,101,310);

line(141,360,101,365);

int x=70;

line(141,305+x,141,440);

line(101,310+x,101,440);

line(141,305+x,101,310+x); q=-200;

line(302+q+4,405+d,302+q+4,440+d);

line(338+q-1,405+d,338+q-1,440+d-2);

ellipse(327+q,405+d,105,180,20,15);

ellipse(313+q+4,405+d,360,80,20,15); d=1;

line(302+q+4,405+d,302+q+4,440+d-2);

line(338+q-1,405+d,338+q-1,440+d-2);

ellipse(327+q,405+d,105,180,20,15);

ellipse(313+q+4,405+d,360,80,20,15); rectangle(178,415,197,439);

setfillstyle(7,15);

floodfill(179,416,15);

rectangle(178,415-75,197,440-76);

setfillstyle(7,15);

floodfill(179,415-75+1,15); line(130-3,417,130-3,440);

line(113+3,420,113+3,440); line(113+3,420,130-3,417);

putpixel(114,423,4);

line(113,440,130,440);

floodfill(114+3,423,15); int a=-76;

line(130-3,417+a,130-3,440+a-3);

line(113+3,420+a,113+3,440+a); line(113+3,420+a,130-3,417+a);

putpixel(114,423,4);

floodfill(114+3,423+a,15); line(10,400+h,615,400+h); //////////////////////////////////////////////right\\\\\\\\\\\

int e=270;

rectangle(150+e,283,226+e,294);

line(146+e+4,294,225+e,294);

line(146+e+4,298,225+e,298);

line(150+e+80,240,150+e+80,440); //pole

line(146+e+80,240,146+e+80,440); line(150+e+80,299,150+e+80,440); //pole

line(146+e+80,299,146+e+80,440); l=400;

h=+149;

ellipse(51+l,132+h-7,340,216,4,15);

ellipse(62+l,131+h-7,327,216,4,15);

ellipse(72+l,132+h-7,327,216,2,15);

ellipse(42+l,132+h-7,327,216,2,15);

ellipse(57+l,107+h,0,170,16,5);

line(40+l,107+h,40+l,140+h-7);

line(75+l,107+h,75+l,140+h-7); line(34+l,107+h,40+l,107+h);

line(75+l,107+h,81+l,107+h); line(34+l,107+h,28+l,102+h); //slant

line(81+l,107+h,87+l,102+h); line(28+l,102+h,34+l,98+h);

line(87+l,102+h,81+l,98+h); line(34+l,98+h,58+l,95+h);

line(58+l,95+h,81+l,98+h);

ellipse(65+l,92+h,104,190,30,30); ellipse(50+l,92+h,350,76,30,30); line(58+l,61+h,58+l,63+h);

circle(58+l,58+h,3);

line(58+l,55+h,58+l,53+h);

circle(58+l,50+h,2);

line(58+l,48+h,58+l,47+h);

circle(58+l,45+h,1);

line(58+l,44+h,58+l,41+h); r=270;

n=n-15; ellipse(227+r,206+n,0,180,9,1);

ellipse(227+r,204+n,0,180,9,1);

putpixel(220+r,204+n,15);

putpixel(220+r,205+n,15);

putpixel(220+r,206+n,15);

putpixel(235+r,204+n,15);

putpixel(235+r,205+n,15);

putpixel(235+r,206+n,15); ellipse(227+r,203+n,0,180,6,7);

line(227+r,195+n,227+r,192+n); line(146+e+135,302,97+e+135,294);

line(146+e+135,306,97+e+135,298); line(146+e+135,291,97+e+135,283); line(100-5+e+190,240+15,100-5+e+190,440); //pole

line(96-5+e+190,240+15,96-5+e+190,440); r=325;

n+=15;

ellipse(227+r,206+n,0,180,9,1);

ellipse(227+r,204+n,0,180,9,1);

putpixel(220+r,204+n,15);

putpixel(220+r,205+n,15);

putpixel(220+r,206+n,15);

putpixel(235+r,204+n,15);

putpixel(235+r,205+n,15);

putpixel(235+r,206+n,15); ellipse(227+r,203+n,0,180,6,7);

line(227+r,195+n,227+r,192+n);

rectangle(155+e,302,220+e,364);

rectangle(155+e,302+70,220+e,364+75);

q=140;

d-=1;

line(302+q-5,405+d,302+q-5,440+d);

line(338+q+5,405+d,338+q+5,440+d);

ellipse(327+q+5,405+d,108,180,35,30); ellipse(313+q-5,406+d,360,74,35,30); d=-77;

line(302+q-5,405+d,302+q-5,440+d);

line(338+q+5,405+d,338+q+5,440+d);

ellipse(327+q,405+d,105,180,30,25); ellipse(313+q,405+d,360,80,30,25);

putpixel(163,300,11);

setfillstyle(6,15);

floodfill(163,330,15);

floodfill(160,380,15);

/////////////////////////////

e=e-15;

line(141+e+150,305+5,141+e+150,360+5);

line(101+e+150,310-5,101+e+150,365-5);

line(101+e+150,305,141+e+150,310);

line(101+e+150,360,141+e+150,365); int v=75;

line(141+e+150,305+5+v-5,141+e+150,440);

line(101+e+150,310-5+v-5,101+e+150,440);

line(101+e+150,305+v-5,141+e+150,310+v-5);

//line(101+e+150,360+v,141+e+150,365+v); e=e+18;

rectangle(178+e,415,197+e,439);

setfillstyle(7,15);

floodfill(179+e,416,15);

int f=-75;

rectangle(178+e,415+f,197+e,439+f);

setfillstyle(7,15);

floodfill(179+e,416+f,15);

e+=130;

line(130-3+e,440+a-2,130-3+e,417+a+2);

line(113+3+e,440+a-2,113+3+e,420+a-2); line(113+3+e,417+a,130-3+e,420+a);

putpixel(114+e,423,4);

floodfill(114+3+e,423+a,15); a=1;

line(130-3+e,440+a-2,130-3+e,417+a+2);

line(113+3+e,440+a-2,113+3+e,420+a-2); line(113+3+e,417+a,130-3+e,420+a);

putpixel(114+e,423,4);

line(113+3+e,440,130-3+e,440);

floodfill(114+3+e,423+a,15);

q=204;

line(302+q+4,405+d,302+q+4,440+d-2);

line(338+q-1,405+d,338+q-1,440+d+2);

ellipse(327+q,405+d,105,180,20,15);

ellipse(313+q+4,405+d,360,80,20,15);

q=204; d=0;

line(302+q+4,405+d,302+q+4,440+d-1);

line(338+q-1,405+d,338+q-1,440+d);

ellipse(327+q,405+d,105,180,20,15);

ellipse(313+q+4,405+d,360,80,20,15);

line(302+q+4,440,302+q+4,440);

setfillstyle(10,15);

floodfill(322,160,15);

setfillstyle(6,15); floodfill(322,193,15);

///////////////////////////////////////////////walls//////////////

setfillstyle(9,15);

floodfill(110,294,15);

floodfill(210,290,15);

floodfill(430,290,15);

floodfill(520,290,15);

/////////////////////////////////////////////poles

setfillstyle(6,15);

floodfill(93,394,15);

floodfill(148,394,15);

floodfill(227,394,15);

floodfill(417,394,15);

floodfill(498,394,15);

floodfill(553,394,15);

setfillstyle(9,15);

floodfill(185,224,15);

floodfill(465,224,15); while(!kbhit())

{

delay(40);

putpixel(random(640),random(248),random(15));

} getch();

cleardevice(); setcolor(13);

rectangle(1,1,639,479);

rectangle(15,15,624,464);

//setcolor(LIGHTBLUE);

setfillstyle(6,11); floodfill(2,2,13);

settextstyle(7,0,3);

setcolor(12);

//delay(1000);

getch();

return 0;

}

CREATED BY C.MUNI PRAKASH TRY THIS U WILL GET IT B.TECH ,CSE ,TRML ENGG COLLEGE

What is the factorial of 569?

The factorial of 569 is 569 * 568 * 567 * ... * 3 * 2 * 1. (That is a very, very large number.) If you mean, however, "what are the factors of 569?", the answer is 1 and 569, because 569 is prime.

What are the different types of programming languages?

A type of programming language could be a domain, paradigm, or family; the related links give taxonomies according to all of these factors. The below answer addresses the question as regards families.

It would be impossible to list them all, but a few of the most common are as follows (listed in alphabetical order):

BASIC - This was the language Bill Gates released for the C64 and other computers. It quickly became a very popular language and matured into Visual Basic, which further matured into Visual Studio. The current implementation is very expensive, however Microsoft have released Express versions of the Visual Studio series which are free, at the expense (removal) of some functionality. There is also a very young cross-platform (Windows, Linux) Free and Open Source (FOSS) implementation of BASIC called FreeBASIC, which I personally program in and find very easy to use. It aims for compatibility with QuickBASIC while giving easy access to the host platform's system functions (the Windows API on Windows and system calls on Linux).

C, C#, C++ - These I don't have much knowledge about, I can only make reference to the existence of "gcc", a cross-platform (the amount of platforms it can compile to is mind-boggling) FOSS compiler. Visual Studio also has compilers for C++ and C#.

Perl, PHP, Python - These are mainly the "web languages" of today. PHP is the most widely used, mainly because of the fact that support for it is compiled into Apache, "the" web server for Linux (which also has ports for Windows and if I'm not mistaken, Mac OS). Perl and Python are also used very widely too, as it's as simple as installing mod_perl into Apache for Perl to work with the same, and I'd imagine Python integration is as easy too.
Computer programming is the craft of writing useful, maintainable, and extensible instructions which can be interpreted by a computing system to perform a meaningful task. Programming a computer can be performed in one of numerous languages, ranging from a higher-level language to writing directly in low-level machine code (that is, code that more directly controls the specifics of the computer's hardware) all the way to writing microcode (which does directly control the electronics in the computer). Using programming languages and markup languages (such as XHTML and XForms) require some of the same skills, but using markup languages is generally not considered "programming." Nevertheless, many markup languages allow inclusion of scripts, e.g. many HTML documents contain JavaScript. There are exceptions where markup languages do represent programming such as SuperX++ (http://xplusplus.sourceforge.net/) and o:XML (http://www.o-xml.org/) Computer programming is one part of a much larger discipline known as software engineering, which includes several different aspects of making software including design, construction and quality control. The subject of this book is software construction, that is, programming. Computer programming is also a useful skill (though not always necessary) for people who are interested in computer science. Whereas software engineering is interested specifically in making software, computer science tends to be oriented towards more theoretical or mathematical problems.

Find the absolute value write a program of a no entered through the keyboard?

#include<stdio.h>

#include<conio.h>

int main ()

{

int num;

printf("enter the number");

scanf("%d",&num);

if(num<0)

num=(-1)*num;

printf("absolute value=%d",num);

getch();

return 0;

}

What is the algorithm using c to delete duplicate elements from an array?

To detect the duplicate, you will have to write a nested loop that compares each element with all the previous elements.

To actually delete the duplicate, once you find it, you have to move over all the elements after the duplicate. If the order of the elements doesn't matter, it is faster to just move the LAST array element, overwriting the duplicate element. Use a variable to keep track how many elements of the array are "usable". For example, if your array had 10 elements, and you delete 1, the array size will still be 10... but (after moving the elements over) only 9 of those elements have useful information.

Add two matrices by using arrays and functions?

#include
#include
void main()
{ int a[10][10],b[10][10],c[10][10];
printf("\nEnter the Row:");
scanf("%d",&r);
printf("\nEnter the Columns:");
scanf("%d",&c);
for(i=0;ifor(j=0;jc[i][j]=a[i][j]+b[i][j];
printf("\nThe Result is:\n");
for(i=0;i{ for(j=0;jprintf("%d\t",c[i][j]);
printf("\n");
}
getch();
}
Syntactical errors may happened.

What are the example of turbo c with using scan and print function?

#include<stdio.h>

Void main()

{

int a,b;

printf("Enter a Number: "); // for print function as an out-put

scanf("%d",&a); //for scan function as in input

/* Here we can use print function once again as: */

a=a++;

printf("%d",a);

}

Bluej program-read a string and check if the given string is a palindrome?

import java.util.Scanner;

public class Palindrome{

public static void main(String[] args){

String front;

String back ="";

char[] failure;

String backwards;

Scanner input=new Scanner(System.in);

System.out.print("Enter a word: ");

front=input.next();

front=front.replaceAll(" ", "");

failure=front.toCharArray();

for (int i=0; i<failure.length; i++){

back=failure[i] + back;

}

if (front.equals(back)){

System.out.print("That word is a palindrome");

}else

System.out.print("That word is not a palindrome");

}}

What is the difference between implementation and algorithm?

An algorithm is a instruction for solving a problem. It is typically illustrated using prose, pseudo code or flowcharts, but other methods exist. The algorithm is the "here's how it's going to work" part of the solution.

An implementation (of an algorithm) is a specific expression of this algorithm, using a specific programming language or any other suitable means. The implementation is the "here's how I've done it" part of the solution.

What are the differences between puts and fputs?

All three functions output a single character, either to the console or to a FILE. putc() takes a character argument, and outputs it to the specified FILE. fputc() does exactly the same thing, and differs from putc() in implementation only. Most people use fputc(). putchar() writes the character to the console, and is the same as calling putc(c, stdout). puts() is a multicharacter function and putchar() is single character function

What is the difference between function calls and Interrupt Service routine?

An Interrupt is a feature of the processor hardware; eg, on an 8051, and interrupt can occur when the UART receives a character.

A Function is a construct of the 'C' programming language - it represents a piece of executable code that can be "called" by other parts of the program.

(other languages have similar constructs)

What are the difficulty that the programmer must overcome writing an operating system for real time environment?

A real time operating system needs to be "event driven" and have the ability to perform certain tasks in a very timely manner.

Most true real-time operating systems use interrupts to handle events as they occur, such as a time-critical input message from a serial port or a digital I/O event from some peripheral hardware.

Next, there should be some kind of prioritization, meaning that one process may be time critical, such as controlling the rods at a nuclear reactor, but other processes might be a little less critical, such as dimming the hallway lights at the reactor facility after hours.

Third, there must be a mechanism in place for "multitasking", meaning that the computer must be able to switch between multiple active processes. Some operating systems create a process "stack" for each process, and if a high priority process is to be activated to handle an event, the operating system simply switches control to the higher priority process by loading the current data from the process stack. A true real time operating system can do that in just a couple clock ticks.

How do you write a simulation program in C?

Its quite easy to code an simulation program in c. An Sample Simulation program in c for Traffic Signal

#include<graphics.h> #include<conio.h> #include<dos.h> #include<stdlib.h> main() { int gd = DETECT, gm, midx, midy; initgraph(&gd, &gm, "C:\\TC\\BGI"); midx = getmaxx()/2; midy = getmaxy()/2; setcolor(RED); settextstyle(SCRIPT_FONT, HORIZ_DIR, 3); settextjustify(CENTER_TEXT, CENTER_TEXT); outtextxy(midx, midy-10, "Traffic Light Simulation"); outtextxy(midx, midy+10, "Press any key to start"); getch(); cleardevice(); setcolor(WHITE); settextstyle(DEFAULT_FONT, HORIZ_DIR, 1); rectangle(midx-30,midy-80,midx+30,midy+80); circle(midx, midy-50, 22); setfillstyle(SOLID_FILL,RED); floodfill(midx, midy-50,WHITE); setcolor(BLUE); outtextxy(midx,midy-50,"STOP"); delay(2000); graphdefaults(); cleardevice(); setcolor(WHITE); rectangle(midx-30,midy-80,midx+30,midy+80); circle(midx, midy, 20); setfillstyle(SOLID_FILL,YELLOW); floodfill(midx, midy,WHITE); setcolor(BLUE); outtextxy(midx-18,midy-3,"READY"); delay(2000); cleardevice(); setcolor(WHITE); rectangle(midx-30,midy-80,midx+30,midy+80); circle(midx, midy+50, 22); setfillstyle(SOLID_FILL,GREEN); floodfill(midx, midy+50,WHITE); setcolor(BLUE); outtextxy(midx-7,midy+48,"GO"); setcolor(RED); settextstyle(SCRIPT_FONT, HORIZ_DIR, 4); outtextxy(midx-150, midy+100, "Press any key to exit..."); getch(); closegraph(); return 0; }

How do you write a C program to implement stacks through arrays?

#include<stdio.h>

#include<conio.h>

#define MAX 10

typedef struct stack

{

int item[MAX];

int Top;

}stk;

void createstack(stk *);

void push(stk *,int);

int pop(stk *);

int isempty(stk *);

int isfull(stk *);

int main()

{

int choice;

int value;

stk s;

createstack(&s);

do{

clrscr();

printf("\n\t Main Menu");

printf("\n1. Push");

printf("\n2. Pop");

printf("\n3. Exit");

printf("\nEnter your choice=");

scanf("%d",choice);

switch(choice)

{

case 1: printf("\nEnter the value to be inserted=");

scanf("%d",value);

push(&s,value);

getch();

break;

case 2: value=pop(&s);

if (value==0)

printf("\n Underflow: Stack is empty");

else

printf("\n Popped Element is %d",value)

getch();

break;

case 3: exit();

defualt: printf("\nInvalid choice");

}

}while(1);

return 0;

}

void createstack(stk *s)

{

s->Top=-1;

}

void push(stk *s,int element)

{

if(isfull(s))

{

printf("\nOverflow: Stack is full");

return;

}

s->Top++;

s->item[s->Top]=element;

printf("\nValue is pushed onto the stack");

}

int pop(stk *)

{

int popped;

if (isempty(s))

return 0;

popped=s->item[s-.Top];

s->Top-;

return popped;

}

int isempty(stk *)

{

return s->Top==-1;

}

int isfull(stk *)

{

return s->Top==MAX-1;

}

What are cheats on foc 8.8n?

-cheat(spacex2)

-agi ##

-str ##

-int ##

-lvl ##

Ascending and descending oreder using functions in c language?

Well There is no "functions"

but there is a way:

#include

main()

{

int n,num;

printf("Enter Number");

scanf("%d",n);

num = n%2;

if(n==1)

{

printf("Your number is Odd");

}

else

{

printf("Your number is Even");

}

return 0;

}

How do you install CCS V4.088?

Install CCS V4 then install the following updates one after the other:

pcbupd.exe

pcmupd.exe

pchupd.exe

pcwhupd.exe

pcdupd.exe

pcwupd.exe

setup_icd.exe

Replace a character by another character in a given string?

C Solution

To replace a single, specified character with another in a given string, one possibility is ...

char *pszString; /* pointer to string */

int offset; /* offset of desired character */

... initialize pszString and offset

*(pszString+offset) = 'A'; /* or whatever new value you want */

Obviously, this is a simple example, and it does not consider if offset is greater than the size of the array.

If you want to replace every occurence of a character with another, here is another possibility, one that also handles string length ...

char *pszString; /* pointer to string */

char* pszTemp; /* temporary scanning pointer */

char cOldChar; /* character to change */

char cNewChar; /* new character */

... initialize pszString, cOldChar, and cNewChar

for (pszTemp = pszString; *pszTemp != '\0'; pszTemp++) { /* scan */

if (*pszTemp == cOldChar) *pszTemp = cNewChar; /* conditionally replace */

}

Java Solution

// Replace all 'e' characters with 'i' characters in String str

str.replaceAll("e", "i");

C program to calculate first symbol of given grammar?

#include"stdio.h"

#include<conio.h>

#define max 10

#define MAX 15

char array[max][MAX],temp[max][MAX];

int c,n,t;void fun(int,int[]);

int fun2(int i,int j,int p[],int key)

{

int k;

if(!key)

{

for(k=0;k<n;k++)

if(array[i][j]==array[k][0])

break;

p[0]=i;p[1]=j+1;

fun(k,p);

return 0;

}

else

{

for(k=0;k<=c;k++)

{

if(array[i][j]==temp[t][k])

break;

}

if(k>c)return 1;

else return 0;

}

}

void fun(int i,int p[])

{

int j,k,key;

for(j=2;array[i][j]!='\0';j++)

{

if(array[i][j-1]=='/')

{

if(array[i][j]>='A'&&array[i][j]<='Z')

{

key=0;

fun2(i,j,p,key);

}

else

{key=1;

if(fun2(i,j,p,key))

temp[t][++c]=array[i][j];

if(array[i][j]=='[at]'&&p[0]!=-1)

{ //taking ,[at], as null symbol.

if(array[p[0]][p[1]]>='A'&&array[p[0]][p[1]]<='Z')

{

key=0;

fun2(p[0],p[1],p,key);

}

else

if(array[p[0]][p[1]]!='/'&&array[p[0]][p[1]]!='\0')

{

if(fun2(p[0],p[1],p,key))

temp[t][++c]=array[p[0]][p[1]];

}

}

}

}

}

}

char fol[max][MAX],ff[max];int f,l,ff0;

void ffun(int,int);

void follow(int i)

{

int j,k;

for(j=0;j<=ff0;j++)

if(array[i][0]==ff[j])

return 0;

if(j>ff0)ff[++ff0]=array[i][0];

if(i==0)fol[l][++f]='$';

for(j=0;j<n;j++)

for(k=2;array[j][k]!='\0';k++)

if(array[j][k]==array[i][0])

ffun(j,k);

}

void ffun(int j,int k)

{

int ii,null=0,tt,cc;

if(array[j][k+1]=='/'array[j][k+1]=='\0')

null=1;

for(ii=k+1;array[j][ii]!='/'&&array[j][ii]!='\0';ii++)

{

if(array[j][ii]<='Z'&&array[j][ii]>='A')

{

for(tt=0;tt<n;tt++)

if(temp[tt][0]==array[j][ii])break;

for(cc=1;temp[tt][cc]!='\0';cc++)

{

if(temp[tt][cc]=='[at]')null=1;

else fol[l][++f]=temp[tt][cc];

}

}

else fol[l][++f]=array[j][ii];

}

if(null)follow(j);

}

void main()

{

int p[2],i,j;

clrscr();

printf("Enter the no. of productions :");

scanf("%d",&n);

printf("Enter the productions :\n");

for(i=0;i<n;i++)

scanf("%s",array[i]);

for(i=0,t=0;i<n;i++,t++)

{

c=0,p[0]=-1,p[1]=-1;

temp[t][0]=array[i][0];

fun(i,p);

temp[t][++c]='\0';

printf("First(%c) : [ ",temp[t][0]);

for(j=1;j<c;j++)

printf("%c,",temp[t][j]);

printf("\b ].\n");

getch();

}

/* Follow Finding */

for(i=0,l=0;i<n;i++,l++)

{

f=-1;ff0=-1;

fol[l][++f]=array[i][0];

follow(i);

fol[l][++f]='\0';

}

for(i=0;i<n;i++)

{

printf("\nFollow[%c] : [ ",fol[i][0]);

for(j=1;fol[i][j]!='\0';j++)

printf("%c,",fol[i][j]);

printf("\b ]");

getch();

}

}

How do you write flag status in program?

for example:

int flag= 0; /* 0/1 = unset/set */
...
printf ("flag=%d which means %s\n", flag, flag? "set": "unset");

What are the functions for Ubuntu?

Ubuntu is a free, supported debian/linux implementation of Unix. As such, you can do nearly anything that you can do in Unix in Ubuntu.

Why there is no runtime checking in c language?

All variables in C are just memory references (excepting register variables, but there's no distinction in terms of this question). C makes no attempt to prevent developers from dynamically accessing any memory location of any memory size. It can only statically type-check during compile time to make sure that "excessively absurd" practices, such as placing an int into a char are generally obeyed, and that flimsy protection can be easily overridden with type casts, which basically assures the compiler that you know what you're doing.

Once a C program is running, all memory is treated as one large memory pool with pointers into it. The data itself has no notion of what it "is" or how it should behave, which is why C has always been claimed to be a "dangerous" language to use; a careless cast can crash a program or even an entire operating system in the case of a kernel programming error. That was a major motivation for most languages that have been developed since.