I am trying to learn c++. One interesting program requires to accumulate a running total of numbers up to a user provided number. Here is the description of the program and the code I've come up with so far. Any help will be greatly appreciated.
//This program asks the user to enter a positive integer value.
//The program then uses a loop to add all the integers up to
//the value entered by the user.
#include <iostream>
using namespace std;
int main ( )
{
double num = 0.0; // Loop counter variable
int maxValue; // Maximum value to display
// Request a number from the user
cout <<"Please enter a positive number: ";
cin >> maxValue;
cout <<"Number Addition" <<endl;
cout <<"____________________________" <<endl;
//Use a loop to add all numbers up to number entered
for (num = 0; num <= maxValue; num++)
num += maxValue;
cout <<num<< "\t\t"; // <<(num + num)<<endl;
return 0;
}