My background: I am a new programmer, taking an "intro to programming II" class (as in white board and desks in a classroom, not definition & implementation), and I am highly enjoying programming. It takes very little research on the internet to realize that I still have A TON to learn about programming. For this class, we program in a linux environment using a GNU compiler. Being the enthusiastic ignorant pre-programmer that I am, I installed Microsoft Visual C++ Express on my computer, to tinker around with the language a little bit more. Express highly annoys me, it formats my text in ways that I HATE, and in this case compiles differently than GNU.
Problem: Being a freshman, me and my friends realized that we are starting to curse far too much, so we came up with an idea for a swear jar. So I volunteered, why buy a jar when you can just program one? Luckily for me, Visual doesn't like the way I handle strings I guess.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
#include <iostream>
using namespace std;
#include <fstream>
int main(int argc, char* argv[])
{
ifstream in;
in.open(argv[1]);
string Name;
while(!in.eof())
{cin >> Name;
cout << Name << endl;};
in.close();
return 0;
}
|
This simple 'native' program (as Microsoft seems to call it) simply repeats the list of names that are in a text file. It works in my Linux environment, but Express won't Compile. Help?
You get a bonus point if you also come up with a good punishment for who ever's name gets selected from the swear jar at the end of this semester!
Thanks!
EDIT: The text editor has red wavy lines under the '>>' and '<<' operators, saying they don't match the operands.