answersLogoWhite

0


Best Answer

set counter K to 0

repeat

{

if a number has been entered (from the keyboard)

{

store in A[K] and increment K

if K equals 2 print A[0]+A[1] and reset K to 0

}

}

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

Event-driven programs are typically used in graphical user interfaces (GUI) and multi-tasking/multi-threaded environments. The operating system maintains a message queue containing events generated by all active applications and services. Every message has an ID denoting the target application, along with the ID of the event itself plus any data that is relevant to the event. When an application is idle, it enters an idle loop which repeatedly checks the first message on the queue. If the application ID matches, the message is dequeued and processed. If the ID does not match, the idle loop terminates.

Since every application is given an allocated time-slice of the CPU according to its priority, so long as the applications are idle during their allotted time then all messages will be processed fairly rapidly. However, if an application is busy and the first message in the queue is intended for it, that message will effectively block all other messages to all other applications. The operating system will appear sluggish because messages are being enqueued all the time but the busy application is preventing them from being processed. To prevent this, programmers must periodically yield control to the system during an intensive process to allow messages to be enqueued, and then enter idle mode to process any pending messages. Once it has dealt with those messages it can continue the intensive process until the next yield point.

Since events can be posted from one application to another, applications must be prepared to deal with them. For instance, if the user chooses to shut down the system, every application will be notified that it must close. But if the application is running an intensive operation then it will not be possible to close the application until that process has been aborted gracefully.

There are various ways of dealing with this, but generally the application will override the idle loop in order to filter messages. That is, the override will dequeue messages but will not process them unless certain conditions are satisfied. This is known as "eating" events. If the event is an instruction to close the application but a process is still running, then the idle loop will store the event and set an abort flag that the process can check at each yield point, allowing it to terminate gracefully. When the idle loop determines there is no running process but the abort flag has been set, it will reset the abort flag and repost the event it stored which can then be dealt with normally.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

Event driven programming is where code gets executed when the user fires a given event. An event can be when a user clicks a button in a program. When the button gets clicked some code will be executed, that would not be executed if the user had not clicked the button.

Have a good day! RandomGeek

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are event driven programs used in?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Event driven programming best suited for?

Best suited for programs that require user input. And meth.


How is event driven programming different from other programming?

write a note on event driven programming


What makes windows os event driven?

Event driven application is a event happening in the operating system, when you click a button it makes an event, also a timer is a event, timers can be used in screen savers, after a certain amount of minutes, the timer will run out and the event for the screen saver to appear will happen :) Hope i helped


Disadvantages of event driven programming?

It uses a wimp hcimaking it user friendly.


Explain event driven programming?

Let's say, I were to go create a button object for the program user to click on...; the button text might say. [Click here] ...or,... [Click here to see Help] ...or,... [Click here to sort list] -etc. At first, the button would just simply sit there; and, therefore, the program would take no further action; except to wait for an 'event' to happen. Whenever the user of my program clicks on that button; then, the button 'click event' will get triggered. The users click might trigger off some other code to start working...such as, when the button is clicked on do this/or, do that...display a text message/or, sort list/ -etc. Each seperate object has it's own list of possible events. For example, a button can have the following list of events... button.Focus() button.Click() button.DoubleClick() -etc. so, the program waits to see what type of event is happenning, first ...and, when a certain type of event does, eventually, occur...then, this leads to more programming code getting executed. This is how OOP/Object Oriented Programming languages...programming using objects/objects that are 'event driven' works.

Related questions

Can event driven programs be used for non graphic application in vb?

depends on what type of shoes you own


What is meant by event driven?

event driven programs do not have a specific pathway in which the programs instructions are executed. different parts of the program are evoked by events that take place during the running of the program.


Event driven programming best suited for?

Best suited for programs that require user input. And meth.


Why vb is an event driven programming language?

because it is driven by events. as it is a language used in programming, then it only makes sense to say VB is an event driven programming language.


When On aircraft equipped with fuel pumps when is the auxiliary electric driven pump used?

In the event engine-driven fuel pump fails.


How is event driven programming different from other programming?

write a note on event driven programming


What makes windows os event driven?

Event driven application is a event happening in the operating system, when you click a button it makes an event, also a timer is a event, timers can be used in screen savers, after a certain amount of minutes, the timer will run out and the event for the screen saver to appear will happen :) Hope i helped


What does event driven scripting language mean?

event driven programming is based upon the events. its flow is based on the events.


Disadvantages of event driven programming?

It uses a wimp hcimaking it user friendly.


What is theDoD decision-support system that is event-driven and involves the process of periodic review and approval of programs to progress into subsequent acquisition life-c?

Defense Acquisition Managemenst System


What is difference between visual programing and event driven programing?

event driven programming is occur when the creat any event means when the user touch the mouse and visual programming does not any oop


Is operating system an event driven program?

yes