Nick Against the World (60 Viewers)

Bjerknes

"Top Economist"
Mar 16, 2004
116,145
I cannot stand when my C++ professor thinks he's some sort of George Can'tstandya when he plays Weird Al Yankovic music videos before class. Why don't you just write I heart computers in programming language, that would be more humorous.
 

mikhail

Senior Member
Jan 24, 2003
9,576
Too long. And I haven't been paying attention to this class whatsoever. What the hell does this:

int main()
{
string x;
while (cin >> x)
{
cout << x << endl;
}
}

do for me? I know the while function but have no idea about "string x"
My C++ is limited, but try compiling and running this.

#include <string>
#include <iostream>
#include <iomanip>
#include <fstream>

using std::string;
using std::cin;
using std::cout;
using std::endl;

int main()
{
string x;

while (cin >> x)
{
cout << x << endl;
}
}

You type some sentence and it breaks it up into words.
 

Max

Senior Member
Jul 15, 2003
4,828
Has anyone ever taken pills for preventing malaria before? If you have, could someone let me know how big these suckers are?

Vacations to the Carribbean are a waste of money; it seems that it would be more healthy to create open sores on your feet and submerge them in a truckstop toilet rather than head south.
 

mikhail

Senior Member
Jan 24, 2003
9,576
Has anyone ever taken pills for preventing malaria before? If you have, could someone let me know how big these suckers are?

Vacations to the Carribbean are a waste of money; it seems that it would be more healthy to create open sores on your feet and submerge them in a truckstop toilet rather than head south.
There aren't any pirates in the truck stop either.
 

Martin

Senior Member
Dec 31, 2000
56,913
Too long. And I haven't been paying attention to this class whatsoever. What the hell does this:

int main()
{
string x;
while (cin >> x)
{
cout << x << endl;
}
}

do for me? I know the while function but have no idea about "string x"
I'm no expert but it looks like you're reading a string from the console and then writing it back once you hit enter. And this loops until you get bored and pull the power plug on your computer.
 

mikhail

Senior Member
Jan 24, 2003
9,576
I'm no expert but it looks like you're reading a string from the console and then writing it back once you hit enter. And this loops until you get bored and pull the power plug on your computer.
Or until you start browsing Myspace with Firefox. There's only so much ram on one computer.
 

mikhail

Senior Member
Jan 24, 2003
9,576
Andy should run this through a profiler to see where the cpu spends its time and how he can optimize it, but short of that I don't think it's a horrible memory hog actually.
Eh, no. It's just Firefox and Myspace will pretty much fuck up any computer. It's where I go to test memory leaks.
 

Martin

Senior Member
Dec 31, 2000
56,913
Yes, but you have to compile, actually first you have to install a compiler (make sure to use -03, we don't want those debugging symbols to slow us down), then chmod +x, then become root (otherwise ulimit will kill it) and then execute.

Or just email to all your friends and tell them it's a word document with a cool macro.

Hm in the old days we could also
echo coolapp.exe >> autoexec.bat
 

Users Who Are Viewing This Thread (Users: 0, Guests: 59)