A sentinel is a loop exit value or list delimiter whose value is outside the range of valid input, such as -1 for a zero-based array index, or ~ for alphabetic strings.
Questions tagged [sentinel]
410 questions
0
votes
1 answer
How can one convert numerous nested if-else statements into a sentinel-controlled while loop?
I'm having trouble with the sentinel-controlled loop structure of the lab I am in. I am supposed to make a program that can determine whether a year is a leap-year or a regular year. So far my professor said I have the boolean logic and the input…

Joel Mesa
- 1
- 1
0
votes
1 answer
My array takes in the sentinel value as an array element and then terminates
I am writing a program that takes in user input and churns out the minimum value.
After 10 inputs the user can type in a negative number as the sentinel to exit the loop.
The problem is this works but for some reason the loop takes the sentinel…

user2769651
- 171
- 1
- 3
- 15
0
votes
1 answer
Java while statement with two values sentinel-control loop won't terminate
Here we're trying to check the validity of the data that has been entered and I cannot figure out what the problem may be. I want to check whether the "number" is either "1" or "2", and if not repeat the prompt until the correct data is entered. …

James Norwood
- 1
- 2
0
votes
1 answer
C: signed integer sentinel value?
I am writing a program wherein I need to turn a character array into an integer. However, instead of just using the positive integers, I need to utilize the full potential of all the integers (in the range of capability of the type int of course)…
user2664110
0
votes
0 answers
Sentinel controlled loop in min-heap structure
I have heap defined as follow:
File: heap.h
#ifndef __HEAP__
#define __HEAP__
typedef struct heap heap;
heap* heap_new();
void heap_delete(heap* h);
void heap_insert(heap* h, int x);
void heap_delete_last(heap* h);
#endif
File:…

Fabio Carello
- 1,062
- 3
- 12
- 30
0
votes
1 answer
xemacs gdb cleanups.c:264: internal-error: restore_my_cleanups: Assertion '*pmy_chain == SENTINEL_CLEANUP' failed
I tried running GDB, version 7.6.50.20130508-cvs (cygwin-special), on Xemacs version 21.4.21 but I get the following error:
/netrel/src/gdb-7.6.50-2/gdb/cleanups.c:264: internal-error: restore_my_cleanups: Assertion '*pmy_chain == SENTINEL_CLEANUP'…

edderic
- 45
- 7
0
votes
2 answers
How too create a bar chart in c++ without functions or arrays
I've spent the past 5 hours trying too write this program, got halfway and realised I cant use arrays or functions, strings etc.
The problem is i need too create a program that reads integer values terminated by a sentinel value and displays a bar…

KingKong
- 37
- 1
- 9
0
votes
7 answers
How can I return a specific object (index) from an arraylist in Java?
I created a class called Student and assigned it 3 values (StudentNumber, Course, Mark); I then assigned a created student (s) to an arrayList called studentsCourses.
This way each student takes up an index in the array. But how do I get the…

Michael MacDonald
- 413
- 2
- 6
- 17
0
votes
1 answer
Getting an NTVDM error while adding '$' to array in TASM
ideal
model small
stack 1024
dataseg
array1 db 11 dup(?)
codeseg
org 100h
PROC MAIN
CALL GETINPUT
CALL PRINTARRAY
EXIT:
mov ah, 4ch
int 21h
ENDP
PROC PRINTARRAY
lea dx, [array1]
mov ah, 9
int 21h
ret
ENDP
PROC…

bheek
- 11
- 3
0
votes
3 answers
multiple inputs into same string c++
I'm attempting to write a c++ program that prompts for several 1 word inputs until a sentinel value is inputted. Once this value, (i.e. "done"), is inputted, the program should output all the words that the user inputted.
I have the general format;…
user2023949
0
votes
5 answers
Stopping thread with sentinel does not work
I'm new to multithreading in java and I can't figure out on how to stop a thread.
I have an ArrayList of threads which I want to stop.
Here is a snippet of my code:
class PrimeThread implements Runnable {
public void run() {
while(flag)…

tim_a
- 940
- 1
- 7
- 20
0
votes
3 answers
Using sentinel-controlled loop
I'm having trouble with an exercise asking to have a user prompt a name and echoes that name to the screen until user enters a sentinel value. I understand this is a sentinel-controlled loop but I'm stuck on the fact that I'm dealing with entering a…

user1864508
- 19
- 1
- 1
- 3
0
votes
3 answers
Keep doing stuff until empty line entered
I cant get this to work for some reason. I have an app that reads transactions, when an empty line in entered it needs to print out some stuff.
int transationCount = 0;
while(sc.hasNext())
{
String trans = sc.next();
…

Deniz Cetinalp
- 901
- 1
- 18
- 34
0
votes
0 answers
AVL Tree Sentinel
I am trying to finish a school project with AVL trees. What happens is that once I insert the root as well as two other nodes everything is ok, the program fails if I try adding any more than those three nodes. I figured that the problem was the…

Lane Fujikado
- 135
- 1
- 3
- 11
-1
votes
1 answer
Redis Sentinel Error condition on socket for SYNC: Connection refused on Ec2 instance
I am trying to connect the master node to slave nodes.
I have created three instances one is master node and another two instance is slave nodes
when i am trying automatic failover in redis sentinel both of the slave node got this…