How many times should the value of inputCount be read?

In summary: First, read in an input value for variable inputCount. Then, read inputCount integers from input and output each integer on a newline after the string "value - "." From this quote, it is clear that the program should only read the inputCount value once, as it states to "read in an input value for variable inputCount". This implies that the inputCount value is only read once to determine how many integers should be read from the input. The phrase "read inputCount integers" does not indicate that the value should be read multiple times, but rather that the value determines the number of integers that should be read. Therefore, the inputCount value should only be read once in the program.
  • #1
Chrisanchez
3
0
First, read in an input value for variable inputCount. Then, read inputCount integers from input and output each integer on a newline after the string "value - ".
Ex: If the input is 2 25 55, the output is:
value - 25
value - 55
Code:
#include <iostream>
using namespace std;

int main() {
int inputCount;
int i;
cin >> inputCount;
for(i=0; inputCount > i | | inputCount < i; ++i){
cin >> inputCount;
cout << "value - " << inputCount << endl;
}
return 0;
}
I'm having trouble figuring out what I'm doing wrong, I able to get the output that I wanted but it keeps repeating the last output that is needed. for example the output that I'm getting is "value - 25 value - 55 value -55 . . ." and it keeps repeating the last output.
 
Technology news on Phys.org
  • #2
How many times should the program read inputCount according to the problem statement? How many times does your program read inputCount?
 
  • #3
Evgeny.Makarov said:
How many times should the program read inputCount according to the problem statement? How many times does your program read inputCount?
It should read inputCount 2 times and output the values after the initial stated amount of times. for example the values are 3, 20, 26, -20. So it should read the 3 as how many times down the list it should output, for example the code output should be 20, 26, -20. But my code for some reason, i do not know, will read the last value, -20, and continue to repeat it for more than 10 times when I need it to read it once.
 
  • #4
Chrisanchez said:
It should read inputCount 2 times
Please convince me that the problem statement really says this. Show me the exact quote and explain why you think the program should read the value of inputCount two times. I suggest using short and clear sentences.
 
  • #5
Evgeny.Makarov said:
Please convince me that the problem statement really says this. Show me the exact quote and explain why you think the program should read the value of inputCount two times. I suggest using short and clear sentences.
This is the question that they are asking me:
First, read in an input value for variable inputCount. Then, read inputCount integers from input and output each integer on a newline after the string "value - ".
Ex: If the input is 2 25 55, the output is:

value - 25
value - 55
 
  • #6
I have already read the problem statement in post #1. There is no need to repeat it. I asked you to provide a small quote that says that the value of inputCount should be read twice. Do you agree, for example, that the phrase 'output each integer on a newline after the string "value - "' has nothing to do with reading inputCount? Then why do you quote it? Please quote only the relevant part that says how many times inputCount should be read. Also describe how you interpret that quote, why do you think it says what is says.
 

FAQ: How many times should the value of inputCount be read?

How many times should the value of inputCount be read in a scientific experiment?

The number of times the value of inputCount should be read depends on the experimental design and the specific variables being measured. In general, it is recommended to read the value at least three times to ensure accuracy and account for any potential errors.

Is it necessary to read the value of inputCount more than once?

Yes, it is important to read the value of inputCount multiple times to increase the reliability of the data. By taking multiple measurements, any outliers or inconsistencies can be identified and addressed, resulting in more accurate results.

Should the value of inputCount be read at regular intervals?

In most cases, reading the value of inputCount at regular intervals can provide a more comprehensive understanding of the variable being measured. However, there may be instances where irregular intervals may be necessary based on the specific experiment being conducted.

Can the value of inputCount be estimated instead of being read?

In some cases, it may be possible to estimate the value of inputCount rather than directly reading it. This approach should only be used if it is scientifically justifiable and does not compromise the accuracy of the data.

How should the value of inputCount be recorded when conducting an experiment?

The value of inputCount should be recorded in a clear and organized manner, along with the corresponding time or interval at which it was read. This allows for easier analysis and interpretation of the data during the experiment and in subsequent analysis.

Similar threads

Back
Top