Why is my first array (arrOne) being modified when I modify a 2nd array (arrTwo)?
When I enter the user inputs of “12345” and “0”, I see in the first loop arrOne is being populated the way I’m expecting 1, 2, 3, 4, 5. However after the 2nd loop (which populates arrTwo) when I go to print out the values of arrOne (using the 3rd loop) I see that the values are now 0, 2, 3, 4, 5.
C++ Primer question on Range for with multidimensional arrays
I am reading C++ Primer and on page 128, it says to avoid array to pointer conversion to use reference like so:
C++ std::array initialisation expecting a “;”
#include <iostream> #include <array> using namespace std; int main(){ array<int,5> a {1,2,3,4,5}; for(int i = 0; i < 5; i++){ cout << a[i] << endl; } return 0; } When I go to compile this, I get this error: error: expected ‘;’ at end of declaration array<int,5> a{1,2,3,4,5}; ^ ; 1 error generated. But I […]
Recalling previous array value to solve new array value?
how do i convert t[i-3] and t[i-1] into an addable value? For example: i = 3, 3 % 2 != 0, cout<<3<<” “<<t[3-1] % 7 (so -> 1 % 7 = 1)<<endl;
How can I compare each number in 2 different arrays with each other?
I’m working on a lottery application: