Question about Computers & Internet

1 Answer

How can multithreading be done on C Language... OR plz tell me... i want to make a programme in c... and when this program is run suppose * is falling from up to down but can i control the movement of *(symbol) using arrow key of keyboard.... i wish the direction of * which is falling from up to down to right when i press Right arrow key of keybord..n to left when i press left arrow key of keyboard...... OR Send me code of snake game in C Language....

Posted by on

  • neerajsahu Aug 30, 2008

    plz tell me a satisfiable practical answer

×

1 Answer

  • Level 2:

    An expert who has achieved level 2 by getting 100 points

    MVP:

    An expert that gotĀ 5 achievements.

    Vice President:

    An expert whose answer gotĀ voted for 100 times.

    Sniper:

    An expert who has posted more than 50 answers, of which 90% or more were rated as helpful.

  • Expert
  • 81 Answers

What you need it's assembly language here example pixel move with arrows:

// I N C L U D E S ///////////////////////////////////////////////////////////

#include <dos.h>
#include <bios.h>
#include <stdio.h>
#include <math.h>
#include <conio.h>
#include <graphics.h>
#include <stdlib.h>

// D E F I N E S /////////////////////////////////////////////////////////////

#define KEYBOARD_INT 0x09
#define KEY_BUFFER 0x60
#define KEY_CONTROL 0x61
#define INT_CONTROL 0x20

// make and break codes for the arrow keys

#define MAKE_RIGHT 77
#define MAKE_LEFT 75
#define MAKE_UP 72
#define MAKE_DOWN 80

#define BREAK_RIGHT 205
#define BREAK_LEFT 203
#define BREAK_UP 200
#define BREAK_DOWN 208

// indices into arrow key state table

#define INDEX_UP 0
#define INDEX_DOWN 1
#define INDEX_RIGHT 2
#define INDEX_LEFT 3

// G L O B A L S /////////////////////////////////////////////////////////////

void (_interrupt _far *Old_Isr)(); // holds old com port interrupt handler

int raw_key; // the global raw keyboard data

int key_table[4] = {0,0,0,0}; // the arrow key state table

// F U N C T I O N S ////////////////////////////////////////////////////////

void _interrupt _far New_Key_Int()
{
asm{
sti
in al, KEY_BUFFER
xor ah,ah
mov raw_key, ax // I get scan code
in al, KEY_CONTROL
or al, 82h
out KEY_CONTROL,al
and al,7fh
out KEY_CONTROL,al
mov al,20h
out INT_CONTROL,al
} // end inline assembly

switch(raw_key) // process the key and update the table
{
case MAKE_UP: key_table[INDEX_UP] = 1; break;

case MAKE_DOWN: key_table[INDEX_DOWN] = 1; break;

case MAKE_RIGHT: key_table[INDEX_RIGHT] = 1; break;

case MAKE_LEFT: key_table[INDEX_LEFT] = 1; break;

case BREAK_UP: key_table[INDEX_UP] = 0; break;

case BREAK_DOWN: key_table[INDEX_DOWN] = 0; break;

case BREAK_RIGHT: key_table[INDEX_RIGHT] = 0; break;

case BREAK_LEFT: key_table[INDEX_LEFT] = 0; break;

} // end switch

} // end New_Key_Int

void setvideomode(void)
{
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "c:\\minc\\bgi");
errorcode = graphresult();

if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* return with error code */
}

}

// M A I N ///////////////////////////////////////////////////////////////////

main()
{
int done=0,x=320,y=240; // exit flag and dot position

setvideomode();

Old_Isr = _dos_getvect(KEYBOARD_INT); // install our ISR

_dos_setvect(KEYBOARD_INT, New_Key_Int);

while(!done) // main event loop
{
if (key_table[INDEX_RIGHT]) x++;

if (key_table[INDEX_LEFT]) x--;

if (key_table[INDEX_UP]) y--;

if (key_table[INDEX_DOWN]) y++;

// draw the cyber dot
putpixel(x,y,15);
delay(10);

if (raw_key==1) // this is our exit key the make code for "esc" is 1.
done=1;

} // end while

_dos_setvect(KEYBOARD_INT, Old_Isr); // replace old ISR

closegraph();

return 0;
} // end main
Assembly is pretty hard language.
Rate me if it helped!

Posted on Jul 07, 2009

1 Suggested Answer

6ya6ya
  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

Hi,
a 6ya expert can help you resolve that issue over the phone in a minute or two.
best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
the service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
click here to download the app (for users in the US for now) and get all the help you need.
goodluck!

Posted on Jan 02, 2017

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

Hii... i want a computer graphics project in C++/ C language... can u plz help me out...


http://dilipnaik11.blogspot.in/2009/07/vtu-6th-semester-engineering-cg-project.html




(programs with output)
http://technogeek.hubpages.com/hub/vtu-computer-graphics-lab-programs

Jan 25, 2013 | Computers & Internet

1 Answer

Java


Did your main page has a same name as java?
Or
You are running in cmd then
javac A.java // this will compile
run like:::::
java A
Any other query then tell me..........

Jul 16, 2012 | Sun Java Programming Language (cdj-275)

1 Answer

Wanted to do a good project on java.suggest d


if u have hardware knowledge,then u can interface a 4x4 matrix keypad with printer port and make a calculator!!
i have done this project, if u need hardware assistance tell me

Jul 14, 2010 | Sun Java Programming Language (cdj-275)

2 Answers

Definition of asp.net & .net frame work


ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites, web applications and web services


The Microsoft .NET Framework is a software framework that can be installed on computers running Microsoft Windows operating systems. It includes a large library of coded solutions to common programming problems and a virtual machine that manages the execution of programs written specifically for the framework. The .NET framework supports multiple programming languages in a manner that allows language interoperability, whereby each language can utilize code written in other languages; in particular, the .NET library is available to all the programming languages that .NET encompasses. The .NET Framework is a Microsoft offering and is intended to be used by most new applications created for the Windows platform.

Jun 02, 2010 | Microsoft ASP.NET Programming with MS...

2 Answers

VIDEO LIBRARY MANAGEMENT SYSTEM source code IN visual basic


You can get your project from

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=70428&lngWId=1

Nov 09, 2009 | Microsoft Visual Basic 6.0 for PC

1 Answer

Color options in turbo c/c++


How Not to Program in C++ how-not-to-program-c.jpg
How Not to Program in C++

How Not to Program in C++: 111 Broken Programs and 3 Working Ones, or Why Does 2+2=5986
Publisher: No Starch Press | ISBN: 1886411956 | edition 2003 | CHM | 280 pages | 1,2 mb
How Not to Program in C++ is a puzzle book with over 100 challenges. Readers must find errors in up to 40 lines of code. By learning to detect the errors, readers become more efficient programmers. Based on real-world programs, readers solve puzzles ranging from easy (one wrong character) to difficult (errors with multiple threads). Clues help along the way, and answers are at the back of the book.


Free Computer eBooks Link:

Download

May 06, 2009 | Borland Turbo C++ 4.5 Full Version for PC

1 Answer

I want to solution of this program.


In what language? VB?Java?C++? Will you have the data placed into the program or ll be obtained automatically from the net? This program ll be able to run in what operating systems?Will it be in a CD or what? Plz more infos!

May 04, 2009 | Computers & Internet

1 Answer

I have a hand written documents which is scanned and stored in a pdf format. i want to write coding to read this pdf file and convert the scanned text into normal text. is it possible using java. please...


No and here's why... Java is a programming language; its purpose is to be used to create programs that do useful things, but it is not equipped to do the complex analyses required to convert images to text. What you need is an OCR "image to text" conversion software application. Java is not such an application; it is a programming language meant to be used by programmers in a "platform independent context" (usually the World Wide Web). I suggest searching Google for what you need using these keyword strings: OCR image-to-text software. OCR stands for Optical Character Recognition.

Note that performing OCR on handwritten text is particularly difficult because it is so non-uniform (irregular). Here is a link that may be helpful in your quest for what is on its face at least by the way you asked, a very difficult process: http://www.softpedia.com/get/Office-tools/Other-Office-Tools/OCR-Image-to-Text-Conversion-Tool.shtml.

As one of my best programming professors (who taught me Java) used to say, "Yes, anything is possible in creating a computer program, but only if you have enough what? Skills, money and time to get the job done! Don't forget: time is money, so you know, don't bite off more than you can chew."

Apr 11, 2009 | Sun Java Programming Language (cdj-275)

1 Answer

To calculate frequence of occurence of syllables in hindi diction


Select Count(*) from <TableName> Where fieldname like '%syllable%';

Mar 15, 2009 | Computers & Internet

Not finding what you are looking for?
Computers & Internet Logo

Related Topics:

434 people viewed this question

Ask a Question

Usually answered in minutes!

Top Computers & Internet Experts

Brian Sullivan
Brian Sullivan

Level 3 Expert

27725 Answers

kakima

Level 3 Expert

98796 Answers

David Payne
David Payne

Level 3 Expert

14071 Answers

Are you a Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...