Hello, I'm taking a 100-class (beginner) in C++
Currently I'm stuck in one of the assignments due where it asks for the program to have the user return to the beginning if there's an error, as well as create an out put of:
+
++
+++
(...)
The current code I have right now is:
#include <iostream>
#include <stdlib.h>
using namespace std;
int main (int argc, char *argv[])
{
int num;
cout << "Enter a positive integer between 0 and 1000: \n";
cin >> num;
if ((num < 0) || (num > 1000))
{
cout << "Error. Please use a positive number between 0 and 1000\n";
}
else
{
for (int i = 0; i <= num; i++)
{
cout << "+";
}
return EXIT_SUCCESS;
}
}
The output is a straight line, but I know the reason to that.