What naaissus said is the problem with your code. think of the operators << and >> as arrows pointing in your code. << points towards cout which means it is pointing "outwards" toward the screen. >> is "inwards" toward the computer.
I am a fresh programmer but I do know that usingnamespace std; should be outside of your program. using that in your main only will keep it in main's scope and will cause problems when you reach function, structures, classes, etc.