Your code contains: usingnamespace std;
If you are only allowed to use what you are taught, then you must have been taught about the namespaces and particularly about the std. How else could you have that line in your code?
However, the std::cout is irrelevant. Lets rephrase: What does happen when you add the necessary bits to my example program, compile it, and run it?