Questions tagged [sentinel]

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.

410 questions
-3
votes
2 answers

Python 3- Assign grade

I am trying to write a program that reads a list of scores and then assigns a letter grade based on the score. Define a function to prompt user to enter valid scores until they enter a sentinel value -999. The function should create a list and…
Hassan Ali
  • 1
  • 1
  • 2
  • 5
-3
votes
3 answers

C# Keeping sentinel value out of my array

This code works when I enter 10 values. If I enter less my sentinel value is added. I'd like that to stop, as well as being able to manipulate my array length so I don't get however many 0's left when entering less than 10. using System; using…
burokkori
  • 1
  • 1
-4
votes
1 answer

(C++) Calculating the average number using while loop

needing some help on how to find the average number of boxes of cookies sold by children using a counter, accumulator, and an end sentinel (basic programming hwk, yay!). I'm having an issue with figuring out why the averageBoxes prints out the wrong…
Frankie
  • 1
  • 1
  • 3
-4
votes
1 answer

How can I read from the same input file multiple times from different points within the file using sentinel values (-1) in c++?

I have a task where I have to read different sections of an input file(.txt) of integers in c++. The file contains an unknown number of positive integers, each separated by white-space with several sentinel values of -1 placed randomly in the list…
Greg
  • 3
  • 5
-4
votes
2 answers

Calling another class in Java

OK, so what I want to do is create 2 classes. One is main class and the second class is to make a loop sentinel control and then return the total of it till the user enters 0. I couldn't get it to work. I don't know how to call the other class…
Hikkup
  • 13
  • 4
1 2 3
27
28