I've been working on this problem for hours now, but can't seem to be able to figure it out. The while loop is running infinitely because the increment function is not working properly. Would really appreciate any pointers.
void Increment(int); int main() { int count = 1; while(count < 10){ cout << “ The number after “ << count; /* Function Increment adds 1 to count */ Increment(count); cout << “ is “ << count << endl; } return 0; } void Increment (int nextNumber) // Increment the parameter by 1 { nextNumber++; }
void Increment (int nextNumber)tovoid Increment (int & nextNumber)nextNumberof yourIncrementfunction needs to be passed by reference (i.e. as a pointer).