Strange Console error

Okay so im having a weird issue, this is my entire code so far
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
using namespace 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

any help appreciated



cout << "The number of times looped: " << num1 << endl;
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.
JAVA! what have you done to me!

okay guys thanks alot
Topic archived. No new replies allowed.