Greetings forum members!
My name is Steven. But I'm known as Tech2011 around various sites.
I am new to this forum. Anyways, I have a quick question about C++ arrays.
So I was hoping to design an array with each array value would increment to the next value.
My code is displayed below. I will then explain my problem.
cout << "Please enter an integer." << "\n" ;
int userint;
cin >> userint;
cin.ignore();
int arraybuildup[2];
arraybuildup[0]=userint;
arraybuildup[1]=userint++;
cout << arraybuildup[1];
I can't explain why, but for some reason, when a value is given for "userint", it outputs the same value on the screen, instead of the incremental value. This is not what I intended.
If anyone has an idea or solution, your thoughts would be most certainly appreciated!
Thanks for your support!
Tech2011
P.S Follow me on Google Plus. I'm Steven Styffe.



LinkBack URL
About LinkBacks



