0

I am totally stuck on this problem and would love it if anyone knew how to help me fix it! Thanks for any input!!!

Here are directions:

Write a program that asks the user for a positive integer value. The program should use a loop to get the sum of all the integers from 1 up to the number entered. For example, if the user enters 50, the loops will find the sum of 1,2,3,4,....50.

Input Validation: Do not accept a negative starting number.

And this is what I have so far:

```
#include <cmath>
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
int main()
{
int number, maxnumber, total;
{
cout << "Enter an integer number: ";
cin >> number;
}
while (number < 0)
{
cout << "ERROR: PLEASE ENTER A POSITIVE INTEGER: " << endl;
cin >> number;
}
for (number = 1; number <= maxnumber; number++)
{
total += number;
}
cout << "The sum of all integer numbers from 1 to ";
cout << << " is: " << total << endl;
if (number >= number);
system("PAUSE");
return 0;
}
```

*Edited 1 Year Ago by Dani*: Formatting fixed