how can i access a direct (absolute, not the offset) memory
address?
here is what i tried:
wrote a program that ask's for an address from the user,
creates a FAR pointer to that adress and shows it. then the
user can increment/decrement the value in that address by
pressing p(inc+) and m(dec-).
NOW, i compiled that program and opened it twice (in 2
different windows) and gave twice the same address to it.
now look what happen - if i change the value in
one "window" of the program, it DOES NOT change in the
other! even if they point to the same address in the memory!
here is the code snippet:
//------------------------------------------------------
#include <stdio.h> //INCLUDE EVERY KNOWN HEADER FILE
#include <conio.h> //FOR ANY CASE...
#include <iostream.h>
#include <dos.h>
#include <process.h>
main()
{
int far *ptr; //FAR POINTER!!!
long address;
char key=0; //A KEY FROM THE KEYBOARD
int temp=0;
clrscr();
cout<<"Enter Address:";
cin>>hex>>address; //GETS THE ADDRESS
clrscr();
(long)ptr=address; temp=*ptr; //PUTS THE ADDRESS IN THE PTR
cout<<"["<<hex<<(unsigned long)ptr<<"]="<<*ptr<<" = "<<
(char)(*ptr);
//SHOWS: [address]=value=ASCII symbol.
while (key!=27) //WHILE YOU DONT PRESS ESC.
{
while(!kbhit()) //WHILE KEY IS NOT PRESSED
{
if (temp!=*ptr) { temp=*ptr; clrscr(); cout<<"["<<hex<<
(unsigned long)ptr<<"]="<<*ptr<<" = "<<(char)(*ptr); };
//IF THE VALUE HAS CHANGED, CLEAR THE SCREEN AND SHOW
//AGAIN
if (key=='p') {key=0; (*ptr)++; } //INCREMENT VALUE
if (key=='m') {key=0; (*ptr)--; } //DEC. VALUE
};
key=getch(); //IF A KEY IS PRESSED, READ IT FROM THE
//KEYBOARD
};
return 0; //IF ESC WAS THE KEY, EXIT THE PROGRAM
}
//---------------------------------------------------------
33
How to handle exception in c++,
For example in a functions i am assigning memory to some
variables and also in next instructions in am dividing one
variable also.
If this functions generates a error while allocating memory
to those variable and also while dividing the variable if i
divide by zero then catch block how it will identify that
this error has cone from perticular instruction
what's the difference between abstract class and concreate
class? what's the meaning of standard template library(STL)?
36
Q1. A. What is unary operator? List out the different
operators involved in the unary operator.
B. What is an adjust field format flag?
Q2. A. Distinguish between a # include and #define.
B. Can a list of string be stored within a two
dimensional array?
Q3. A.Explain how a pointer to function can be declared in
C++?
B.List the merits and demerits of declaring a nested
class in C++?
Q4. A. What are the syntactic rules to be avoid ambiguity
in multiple inheritence?
B. Explain the operation of overloading of an
assignment operator.
Q5. A. Explain how the virtual base class is different
from the conventional base classes of the opps.
B. Explain how an exception handler is defined and
invoked in a Program.
Q6. A. What is a binary file? List the merits and demerits
of the binary file usagein C++.
B. Write short notes on Text Manipulation Routines.
C. Write bites in Turbo c++ Header (“Include”) Files.
what is software cycle?
What is a mission critical system ?
What is the important aspect of a real-time system ?
Explain the difference between microkernel and macro kernel.
Give an example of microkernel.Why paging is used ?
Which is the best page replacement algo and Why ?
What is software life cycle ?
How much time is spent usually in each phases and why Which
one do U want to work if selected in Honeywell ?
Which are the different types of testing ?
What is a distributed system ?
Some questions about CSP.
Which languages do U know ?
What are the differences between Pascal and C.
questions from Compiler construction and Lisp.
Which are the different computer architecture?
What is the requirement in MIMD ?
What is the difference between RISC and CISC processors ?
Difference between loosely coupled and tightly coupled systems ?
What is an open system?
Describe the My Computer and My Documents folders;
identify the elements that are present in every Window.
60
When is the last time you coded in C/C++? What is the most
lines of original C/C++ code you have personally written in
one project? How confident are you in your ability to write
C or C++ without a reference?
Write a program using GUI concept for the scheduling
algorithms in Operating system like SJF,FCFS etc..
40
If P is the population on the first day of the year, B is
the birth rate, and D is the death rate, the estimated
population at the end of the year is given by the formula:
The population growth rate is given by the formula:
B – D
Write a program that prompts the user to enter the starting
population, birth and death rates, and n, the number of
years. The program should then calculate and print the
estimated population after n years. Your program must have
at least the following functions:
1. growthRate: This function takes its parameters the
birth and death rates, and it returns the population growth
rate.
2. estimatedPopulation: This function takes its
parameters the current population, population growth rate,
and n, the number of years. It returns the estimated
population after n years
Your program should not accept a negative birth rate,
negative death rate, or a population less than 2.
please answer my question ....
Am studying basic c++ programming, have been given the
following assignment. Design a linear program to calculate
the maximum stress a material can withstand given a force
and a diameter of a circle. To find the required area pi
should be defined.
Have most of the program sorted out but am at a loss as to
how to show the calculations required. Can anyone help?