#include <iostream>
usingnamespace std;
int main()
{
int SP = 1; //sets a starting point for the loop
int num1;
cout << "Please enter the number of how many times you want the message to loop" << endl;
cin >> num1;
do
{
cout << SP << endl;
SP=SP+ 1;
}
while (SP <= num1);
cout << "The number of times looped: " + num1 << endl;
}
The error is not with the do while l oop, but rather the cout just after it cout << "The number of times looped: " + num1 << endl;
It cuts off part of the message its supposed to display and does not display "num1" after it
The + operator will not append num1 to the string. What you need to do is feed the integer into cout separately. Use Moschops line instead of your own line 16.