int listsize, count;
cout<<"Define size of list: ";
cin>>listsize;
cout<<endl;
int list[listsize];
Are there any problems with this? It works fine but I just want to make sure I'm not committing a faux pas.
Name:
Anonymous2010-05-06 16:30
cin>>listsize;
Never ever EVER do that.1
Do this:
#include <sstream>
#include <string>
and
string line;
getline( cin, line );
stringstream( line ) >> list[count];
Now that's proper input!2
_________________________________________________________________ 1It's bad, it will break cin, it will break your skull, and those of your family and friends. 2And it will hax your anus, ANUS THE HAXUS