This is an example from a book I am going through. Why do you need a constant integer, why cant I just set it to a normal integer and then never change it? Also, what doesCode:#include <iostream>
#include <assert.h>
using namespace std;
const int N_Primes = 7; // Number of Primes
int primes[N_Primes] = {2, 3, 5, 7, 11, 13, 17};
int main( )
{
int index = 10;
assert(index < N_Primes);
cin.get();
assert(index >= 0);
cin.get();
std::cout << "The tenth prime is " << primes[index] << '\n';
cin.get();
return(0);
}
mean? Index is greater then = 0? Why dont I just put it as being greater then N_Primes, since that is what I want it not to go over. So confusing...Code:assert(index >= 0);