subject

Write a function read_int that mimics system call 5 (but only for non-negative integers). The function needs no input parameters but should return the integer generated by the user key presses (appropriately stored onto the stack). To read in an integer, your function should listen for and read in MMIO keyboard inputs until either (a) the user hits the enter key or (b) 10 characters have been exceeded [since the largest possible signed 32 bit integer is 2147483647, which has 10 characters]. If the user inputs an invalid character such as a letter (e. g., β€˜a’) or symbol (e. g., β€˜$’), your function should return -1 to indicate that an invalid number has been entered. Along the same lines, if the user tries to enter a negative number (e. g., contains β€˜-β€˜ character) or too large of a number (i. e., causes overflow), also have your function return -1. Lastly, if the user types no characters at all and hits the enter key, return -1. Here are some examples that you can use as test cases:

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 01:30
For a typical middle-income family, what is the estimated cost of raising a child to the age of 18? $145,500 $245,340 $304,340 $455,500
Answers: 2
question
Computers and Technology, 23.06.2019 05:20
What did creator markus β€œnotch" persson initially call his game
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
Given a link with a maximum transmission rate of 32.8 mbps. only two computers, x and y, wish to transmit starting at time t = 0 seconds. computer x sends filex (4 mib) and computer y sends filey (244 kib), both starting at time t = 0. statistical multiplexing is used, with details as follows packet payload size = 1000 bytes packet header size = 24 bytes (overhead) ignore processing and queueing delays assume partial packets (packets consisting of less than 1000 bytes of data) are padded so that they are the same size as full packets. assume continuous alternating-packet transmission. computer x gets the transmission medium first. at what time (t = ? ) would filey finish transmitting? give answer in milliseconds, without units, and round to one decimal places (e.g. for an answer of 0.013777 seconds you would enter "13.8" without the quotes)
Answers: 3
question
Computers and Technology, 23.06.2019 16:50
15: 28read the summary of "an indian's view of indian affairs."15 betterin "an indian's view of indian affairs," it is asserted that conflicts could be reduced if white americansunderstood native americans..pswhich of the following would make this summary more complete? eleo the fact that chief joseph believes the great spirit sees everythinthe fact that chief joseph was born in oregon and is thirty-eight years oldo the fact that chief joseph states that he speaks from the hearthehehethe fact that chief joseph of the nez percΓ© tribe made this claimebell- ==feetle===-felsefe ==submitmark this and retum.=
Answers: 3
You know the right answer?
Write a function read_int that mimics system call 5 (but only for non-negative integers). The functi...
Questions
question
Arts, 05.05.2020 12:08
question
Mathematics, 05.05.2020 12:08
question
Mathematics, 05.05.2020 12:08