Computers and Technology

Problem Statement EIGER is a brand-new, made-up computer language. It's very exciting, and very simple! EIGER only allows the programmer to do two things: define a name for an integer, and compare two names. Write a metaprogram - a program which can simulate the EIGER language.
For this problem, you will write a complete program that takes its input from stdin and outputs the answer to stdout. Your input will be a program in EIGER, and the output is simply the outputs of the program.
Each line of input contains one command. A definition command has the form
define i x
where i is an integer in the range [-100, 100], and x is a string of up to 20 lowercase alphabet characters (a-z).
A comparison command has the form
eval x comp y
where x and z are strings of the same format as in definitions, and comp is one of <, >, or =.
For each definition, use the string as a label for the given integer but don't output anything. Redefinitions are allowed. For each comparison, state whether it is true or false, depending on the current definitions. If the result is not known, output 'undefined.
Constraints
. All programs will have between 1 and 100 lines of commands.
Examples
1. define -78 argon
eval argon> argon
Output:
false
2. define -62 x define -28 2
eval y > 2
Output:
undefined
3. define 46 purple
eval purple blue
eval purple -purple
define 3 orange define 77 yello
define-76 violet
define 42 violet
eval gray orange
define 16 yellow
eval yellow- gray
eval violet < purple
eval violet < yellow
Output:
undefined
true
undefined
undet ined
true
false
1 Winclude
2
3 using namespace std;
4
5 - int main() {
6 // fill in code here
7 }
8

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 10:30, tommyaberman
Would a ps4 wired controller work on an xbox one
Answers: 1
image
Computers and Technology, 23.06.2019 19:40, Latoyajenjins1789
Use a physical stopwatch to record the length of time it takes to run the program. calculate the difference obtained by calls to the method system. currenttimemillis() just before the start of the algorithm and just after the end of the algorithm. calculate the difference obtained by calls to the method system. currenttimemillis() at the start of the program and at the end of the program so that the elapsed time includes the display of the result. use the value returned by the method system. currenttimemillis() just after the end of the algorithm as the elapsed time.
Answers: 3
image
Computers and Technology, 24.06.2019 09:30, bhadd4385
What is the definition of digital literacy?
Answers: 1
image
Computers and Technology, 24.06.2019 16:30, magalya01
Which program can damage your computer?
Answers: 1
Do you know the correct answer?
Problem Statement EIGER is a brand-new, made-up computer language. It's very exciting, and very si...

Questions in other subjects: