sorry for late reply, also you realize i can't just give you the correct answer in that case i will not be helping you learn, i'll give you some references
where you can dig out and learn.
an array is a contiguous section of memory, so if i have an array
of strings like this.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
string array[6];
///each of the array[0], array[1],array[2],array[3],array[4] till array[5]
///are like individual variables.
///to read data into my array, i'll simply put it in a loop like you have done
//on line 11 but i'll use the variable " x" as my index.
///in your case you are only reading data into one variable
cin>>y[size] ///wrong , y[size] doesn't even exist, it is one past the end of
/// your array. use "x" instead of "size".
///for using conditional statements, i see you have an idea.
/// before you read a value into your array it must be within 0 -100.
///that can be done with a simple if statement that checks if a value
/// is within those bounds you should read the value into a temporal
///variable and then check it.
if(value greater that 0 and value lesser than 100)
{
if(value is -99) exit loop
else {store value into the current index.}
}
//your line 18 is wrong. you should print the elements until you find
//-99 not add them
|
read about arrays.
https://bytes.com/topic/c/answers/616887-filling-arrays-input
https://stackoverflow.com/questions/32290948/user-input-into-an-array
http://www.cplusplus.com/doc/tutorial/arrays/
read about conditions
http://www.learncpp.com/cpp-tutorial/36-logical-operators/
http://en.cppreference.com/w/cpp/language/operator_logical
https://cal-linux.com/tutorials/conditionals.html
https://stackoverflow.com/questions/6241672/multiple-if-statements-in-c
printing elements of an array
http://www.cplusplus.com/forum/beginner/22835/
http://www.dreamincode.net/forums/topic/227165-how-do-i-print-the-contents-of-an-array/