answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

Methods for storing binary trees?

Nodes, references and arrays are the methods for storing binary trees. It can also be stored in breath first order.

How can you make a point counter for your DarkBasic Pro game?

It depends how you want to do it. For a basic text counter it's very easy. First setup a global variable in the initialization of your code: global pCounter = 0 In the portion of your code where you detect that the player has scored, simply increment the counter by an appropriate value: pCounter = pCounter + 1 Then to display it on the screen (in this example, the upper left hand corner), simply use a text command: text 10,10,STR$(pCounter) The two 10's are specifying the number of pixels in the X and Y direction away from the upper left corner where the text should be put and the STR$(...) around the pCounter variable is used to turn it into a string. To make a graphical score counter for a 3D game, here are some functions you can use: function SetupCounter() for i=100 to 109 : load image STR$(i-100)+".jpg",i : next i X# = 3 // if you're using a widescreen resolution, set to 3.6 for n=60 to 64

make object plain n,.2,.2

position object n,X#,2.2,4

lock object on n

texture object n,100

ghost object on n

set object light n,0

dec X#,.2

next n global PlayerScore = 0 endfunction function ControlScore()

score$ = STR$(PlayerScore)

length = len(score$) texture object 60,100+val(mid$(score$,length)) if length>1 then texture object 61,100+val(mid$(score$,length-1))

if length>2 then texture object 62,100+val(mid$(score$,length-2))

if length>3 then texture object 63,100+val(mid$(score$,length-3))

if length>4 then texture object 64,100+val(mid$(score$,length-4))

endfunction Here's how you can use it: 1. Create ten 80x80 JPEG images with the numbers 0-9 surrounded by black called "1.jpg", "2.jpg", etc. and put them in the same directory as your code. 2. Copy and paste the above functions in your code. 3. In the initialization part of your code, call SetupCounter() 4. Whenever the player scores, increment the PlayerScore variable appropriately. 4. Then in the main loop of your code, call ControlScore() This will create a four digit score counter with transparent numbers in the upper right corner of the screen. Make sure you don't have any other objects with ID numbers 61-64 or image numbers from 100-109

Difference between all mll and hll?

HLL is what we humans use. Its full name is High Level Language. MLL is what machines use. Its full name is Machine Level Language. The difference is, HLL is our language (e.g English) and MLL is machines language (binary code)

Binary code is 0s and 1s so "A" could be 010 in MLL. MLL is understood only by the computer and not humans

What is code of finding all subset in a set in c?

Each element of C can either be in a particular subset or not in it - two options for each element of C. So if there are n elements in C, then the number of subsets of C is 2n. These include the null set and C itself.

What is difference between visual c plus plus and mfc?

That is like comparing apples and trees...

Visual C++ is a development environment that allows one to program in C++, which is a language.

MFC (Microsoft Foundation Classes) is a library to allows one to use C++ to write MS Windows programs using a particular set of API-like calls. It is a library, not a language.

The two cannot really be compared, as they are too different in scope.

Using Fortran, create a program that reads tick data (dat file) of stock prices and outputs one second bars to the screen with an open blank line every second?

! Program to read tick data (dat file) of stock prices and output one second bars to the screen with an open blank line every second.

program one_second_bar

implicit none

! Declare the variables

integer, parameter :: maxSize = 30000 ! Maximum size of dat file

integer :: n, i, time_read ! n: number of elements in dat file ; i: loop index ; time_read: time of the last read element

real, dimension(maxSize) :: stock_price ! Array to store stock prices

real :: open_price, high_price, low_price, close_price ! variables to store open, high, low, close prices

! Read the data file and store data into array

open(unit=10, file='stock_price.dat')

read(10, *) n

do i = 1, n

read(10, *) stock_price(i)

end do

close(10)

! Iterate through the array and calculate open, high, low and close prices

time_read = 0

open_price = stock_price(1)

high_price = stock_price(1)

low_price = stock_price(1)

do i = 2, n

if (i > time_read + 1) then

  write(*,*) 'Open: ', open_price, ' High: ', high_price, ' Low: ', low_price, ' Close: ', close_price

  write(*,*)

  time_read = i

  open_price = stock_price(i)

  high_price = stock_price(i)

  low_price = stock_price(i)

else

  if (stock_price(i) > high_price) then

    high_price = stock_price(i)

  else if (stock_price(i) < low_price) then

    low_price = stock_price(i)

  end if

end if

end do

! Output the last bar

close_price = stock_price(n)

write(,) 'Open: ', open_price, ' High: ', high_price, ' Low: ', low_price, ' Close: ', close_price

end program one_second_bar

What is form utility?

form utility; a producers ability to satisfy a human want or need.But; is legal or formal.

What is mblob?

A BLOB is a binary large object which is a chunk of data for a database. An mblob is a medium blob used in php code for an SQL databse.

Is basefont tag an empty tag?

No.

The <basefont> tag specifies the default font for text on page.

Example usage:-

<head>

<basefont face="courier, serif" size="5" color="red">

</head>

IMPORTANT: the <basefont> tag is no longer supported (since HTML5). It is still supported by Internet Explorer 9 and earlier versions but, regardless, you should be using CSS for style and HTML for content, never HTML for both style and content.

What is the solution of error code 80072e3?

Without knowing which program or system generated the error it is impossible to say. The error code is just a number. Many programs and systems may produce the exact same error code but its actual meaning is specific to the program or system that generated it.

How do you convert a string into a character array?

A string is, by definition, a character array. No conversion is required.

What is relocation factor?

Sry....Still im searchng for ths answer.if i get the answer for ths questions means i ll updaate you:(

How Write a c program to find and replace a string in the given text?

  1. #include
  2. # include
  3. char c1,c2,a[80];
  4. void main()
  5. {
  6. clrscr();
  7. find_rep();
  8. getch();
  9. }
  10. void find_rep(void)
  11. /* Function to find & replace any text */
  12. {
  13. char c1,c2;
  14. char a[80];
  15. int i,j,k;
  16. printf("Enter a line of text below:-");
  17. printf("Press Enter after line..");
  18. printf("You Have Entred:- ");
  19. gets(a);
  20. printf("Enter the replaceable & replacing letter respectively:- ");
  21. scanf("%c %c %c",&c1,' ',&c2); //i have given space & 2nd %c
  22. for (j=0;j<80;j++)
  23. {
  24. if (a[j]==c1)
  25. a[j]=c2;
  26. }
  27. puts(a);
  28. printf("Here all %c are replaced by %c.", c1,c2);
  29. return;
  30. }

What next step should occur after a programming problem is analyzed and a flow chart is constructed?

Modern software design methodologies rarely use flowcharts anymore (especially not if you are doing object oriented design/programming).

The step by step design process goes as follows:

  1. requirements analysis *
  2. define acceptance test cases *
  3. preliminary design
  4. define top level test cases @
  5. detailed design
  6. define unit test cases @
  7. write code
  8. write unit test code and procedure @
  9. perform unit test @
  10. top level integration
  11. write top level test code and procedure @
  12. perform top level test @
  13. system level integration
  14. write system acceptance test code and procedure *
  15. perform acceptance test *
The steps marked with * are usually performed by a Systems Engineer and the rest are performed by a Software Engineer. The Systems Engineer can perform step 14 at any time after he performs step 2, he does not need to wait for step 13 to be done.

The steps marked with @ in some methodologies are performed by a Software Test Engineer not the Software Engineer that did the design for the purpose of independent verification and make sure the Software Engineer does not miss something because he "expects it to work".

In some methodologies step 7 is done by a Computer Programmer who does not have as much training, experience, and knowledge to qualify as a Software Engineer, but can write working code when given design documents.

What is anti-dependence?

Statement S2 is anti-dependent on statement S1 if S2 follows S1 in program order and if the output of S2 overlaps the input of S1. The anti-dependence S1 to S2 define as cross arrow such as S1 |-> S2.