PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
You can us the preview button at the bottom to see how it looks.
Other than the space in line 1 being in the wrong place, which I found made no difference, but I have more often seen #include <iostream> written this way as other "#include" and #define".
I put your code in Visual Studio 2015 and it compiled and ran fine.
So, maybe it is the compiler that you are using or the way you are using it. Hard for me to say because I have not used that before.
This confirm that the compiler is the problem .It is the cpp code compiler by Anton Smirnov that I took on the AppStore for I have an iPad.
I don't think visual studio works on iPad but thank you and I'll heed your advice on code for the next time.
I use Anton Smirnov's CppCode compiler on my iPad: mainly for testing short snippets of code on the train, when I haven't got access to my PC. It works fine.
I've just read this latest reply.Perhaps I have to complete the app purchase though i don't see how those errors are related to this.
I suppose you have purchased the complete application.
No, I use the free version, although I am contemplating purchasing the full app. It is limited, so every 3 times I run the code I have to close it and restart it. However, it does point out errors before you run, so it's not as bad as you think. The main problem with the iPad is that you can't get properly at the file system to store anything.