I'm not sure why this code isnt working

Jun 3, 2016 at 12:53am
I just want it to save the number they put in as the maximum, but it just prints out 0

int main()
{
int number = 0;
int number2 = 0;
int maximum = 0;
int amount = 0;

cout << "Enter an integer (enter 0 or less to stop)" << endl;
cin >> number;


while (number > 0)
{
cout << "Enter an integer (enter 0 or less to stop)" << endl;
cin >> number;

if (number > 1)
{
number = maximum;
cout << maximum;
}


}

Jun 3, 2016 at 6:49am
It prints 0 because you output maximum which is zero.
Jun 11, 2016 at 9:54am
This should be moved into General C++ Programming or Beginners. Unfortunately, I feel like this website have been abandoned.
Jun 11, 2016 at 4:52pm
Not abandoned. This is just what happens when there is only one admin who has a family to care for. They get priority and the site gets pushed back.
Jun 11, 2016 at 11:32pm
As much as it is well founded to sacrifice things for the sake of your family, this is still not a reasonable excuse to utterly disregard something as valuable as this website as it contains a lot of helpful contents as well as bright and intelligent people who half seem to have left. They could always find more admins if that's the case.
Jul 4, 2016 at 6:16am
Missed this reply. The site is done by one person in their spare time. If he is like most that do this, he would likely sooner shut down the site than leave it in the hands of another person. On the contrary to your belief, this is the internet, I've watched sites shutdown at a whim with zero reason given while I've seen sites shut down, attempted to be brought back, just to be shut down again. The admin could decide tomorrow that this site has had its run and close it down completely, and that is his choice. Just as it is his choice of when and how to interact with it. Doesn't matter if you or anyone else agrees with his decision.
Topic archived. No new replies allowed.