560 Posted Topics
I've been trying to make a reliable IRC client for a while now, and I know very little about sockets. I have read the RFC quite a bit, but programmatically responding when appropriate, and detecting errors still boggles me. How is the program to know the server will send three … | |
Re: Search for record by student ID: [code] #include <iostream> #include <string> #include <fstream> #include <sstream> using namespace std; int main() { ifstream inFile; string result = ""; string id = "10364"; string line; inFile.open("records.txt",ios::binary); while( getline(inFile,line) ) { stringstream ss(line); if( ss >> result ) { if(result == id) { … | |
Re: Counter Strike Source Beta sounds like a good game to be a bodyguard in, just for shoots and giggles. | |
Re: Yes the variables you initialize in the body of the for-loop are local to the loop body's enclosing scope. I think that's written somewhere or something. In older implementations of C++ that was actually an option for Microsoft's compiler, probably even Version 6.0 of it. Heck there may still be … | |
Re: [url]http://archive.msdn.microsoft.com/changexifwithcsharp[/url] | |
Re: Is the name of the file actually "Dictionary" or "Dictionary.txt" ? Also, with Vista above you actually can't read/write files in the root directory [noparse](C:)[/noparse] without admin priviledges. Run your project as an administrator and see what I mean. | |
Re: Hey if you're using linux why not give the C++0X threads a try? [url]http://www.cnn.com/video/?/video/cvplive/cvpstream1[/url] I don't know how to use the pthreads library or I would be able to help more, sorry :( | |
If ASIO had better documentation I could probably have found for myself an answer, but instead... Is there a way to determine bytes available to read using the asio::ip::tcp::iostream ? I really like the tcp iostream because it's super-easy to use, but I haven't found it exactly feature-packed. Does it … | |
It has occurred to me that there are very many factories in my area that use CNC (Computer Numerical Controlled) Lathes and other computer controller machinery. Is the operation of this machinery typically a job for a software programmer or does it require specialized knowledge? Is it worth doing with … | |
Re: Post your code inside the code tags: [noparse] [code] /* CODE HERE */ [/code] [/noparse] Also, please preserve the formatting (posting in the code tags will do that). You will need to copy it from it's original source again. Here's a tip for your "filler" function though, read a line … | |
Re: Will this help? C++ tokens: [code] #include <iostream> #include <string> #include <sstream> #include <vector> using namespace std; int main() { string line = " some tokens and a few 2349582346 2435 555 32 2 2 2 numb3r5"; stringstream ss(line); vector<string> tokens; string temp; while( ss >> temp ) tokens.push_back(temp); for(vector<string>::iterator … | |
Re: Was thinking of the C++ primitive types, Not that funny actually. | |
Re: Initializing variables to zero. [code] float yards[32] = {0.0f}, passyards[32] = {0.0f}, points[32] = {0.0f}; [/code] If you're using visual studio you can set a "breakpoint" and debug the application. See the link in my signature for a youtube video on it. Chances are you aren't reading them from the … | |
Re: Ctrl + X is sometimes a system command that may terminate or suspend the program. On windows it's probably Ctrl + C. | |
Re: I think this is a terrible event, since when is LulzSec anyone's enemy (besides the government)? They compromised the NASA website? Why?! LulzSec exposed a CIA botnet, why would the CIA have a botnet? Isn't this botnet preying on unsuspecting users? I don't want the CIA to have a botnet, … | |
Re: Last program of the class and you can't construct a for loop? [code] //Syntax: //for( ; ; ) //for( <initilization, normally a loop-control variable>; <test expression>; <increment/decement> ) //As such it follows that: for(int i = 0; i < 100; i++) cout << i << endl; //is a valid count-controlled … | |
[url]http://www.cnn.com/video/#/video/politics/2011/11/01/pkg-moos-perry-loosey-goosey-giddy-new.cnn[/url] This is hilarious (to me), but also potentially of concern for undecided voters or even Perry supporters, so I'd like to hear some feedback, what do you all think is going on with Rick Perry here? | |
I have a combobox I need to display some data in from a Database, but there are duplicates and I don't know how to select the distinct ones. Any help? | |
I have a form with a number of controls on it, and I had thought that the "Controls" property of the form instance contained all of the controls on the form as per the documentation. Actually it does, but now iterating over all of my controls becomes similar to iterating … | |
Re: instead of spaces or tabs use [b]setw[/b] [code] #include <iostream> #include <iomanip> using namespace std; int main() { cout << setw(10) << "First" << setw(10) << "Last" << endl; cout << setw(10) << "Somename" << setw(10) << "lname" << endl; cout << setw(10) << "Somename" << setw(10) << "lname" << … | |
Re: [QUOTE=jwenting;1694037]Bill Gates money: school computers in African bush villages without electricity Michael Jordan money: 200mph capable Ferrari stuck in an LA traffic jam Both actual, Bill Gates donates a lot of money to organisations buying computers and medical supplies for developing countries, Jordan spends it all on expensive toys for … | |
Re: SDL_PollEvent returns 0 when no events are left to process, perhaps this happens more often than you realize? Also the nature of polling implies if you wait too long between polls (doing work in your switch) you may miss something. | |
Re: Perhaps you would prefer to use an STL container like a deque or vector? [url]http://www.cplusplus.com/reference/stl/deque/[/url] [url]http://www.cplusplus.com/reference/stl/vector/[/url] Both containers appear to provide random access iterators and a dynamic size. | |
Re: [quote][icode]void main()[/icode][/quote] Use [icode] int main() [/icode] or [icode] int main(int argc, char *argv[]) [/icode] as your entry-point, "void main" is not and never has been valid C or C++. [quote][icode]void DisplayBelowAverage( const string; const int[]; int, double);[/icode][/quote] replace ';' with ','. [quote][code]void DisplayPlayerData(playerNameAr[], scoreAr[], numPlayers)[/code][/quote] that is not valid … | |
Re: Post your code inside the code tags (available on most forums): [noparse] [code] /* code here */ [/code] [/noparse] For your "IsOperand" function there are some functions in <cctype> that you may want to look into using, particularly isalpha() and isdigit(). Alternatively you can build an alphabet as a string … | |
Re: There are certainly some jobs in the CS department that don't involve programming. You know what they say, those who can't do, teach. | |
Of course they will probably work out a solution, but what will happen if the U.S. government shuts down? [url]http://money.cnn.com/2011/11/18/news/economy/debt_committee/index.htm?source=cnn_bin[/url] What parts of defense and nondefense spending will be cut automatically? What about agencies like the CIA and FBI? What about military funding for the Army and such? | |
If you or anyone you know is on the needy list this winter, you may want to sign this petition: [url]http://wh.gov/jyC[/url] Hey it's better than Obamacare and it might actually help some people. | |
Re: I'm not sure I entirely understand your question. You would like to define a string constant, correct? [icode] const char *WARRIOR = "Warrior"; [/icode] -or- [icode] const string WARRIOR = "Warrior"; [/icode] [code] void play(char gameWorld[][BOARD_SIZE]) { Warrior war(1,1); int userChoice = getUserChoice(); string currentPlayer = WARRIOR; while(userChoice != 'q') … | |
Re: Post your code inside of code tags: [noparse][code] /* code */ [/code] [/noparse] | |
Re: You can do that with a registry entry, the location fails me at the moment. Also you can use the task scheduler to do it (preferred). | |
Re: I bought a book on C# and read most of it one day, the knowledge seemed to sort of sink in once I wanted to use C# for some small projects. | |
Re: If you wouldn't mind using QT I suppose you could try: [url]http://doc.qt.nokia.com/latest/qftp.html[/url] One word of advice, I would recommend using the QT installer on Windows, definitely. Alternatively there are other projects, [url]http://sourceforge.net/projects/poco/[/url] As for the command line arguments, as you probably already know [icode] char *argv[] [/icode] contains the command … | |
Re: oh sure let me get right on that, just for you bro! | |
This is my first time trying to use a web API with C#, a friend asked me to make him a simple remote control app. I don't really know where to begin, I'm thinking I can create a [URL="http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx"]WebRequest[/URL] filled with the proper info, is this going to work? A … | |
I have accepted an internship that involves re-writing a project written in "Clipper Summer of '87" in C#, and basically it's missing a couple source code files and I have no idea how to work with the database files it uses. I do know it uses something called "dBase III" … | |
Re: You could find some open source project that sucks and improve it. [url]www.sourceforge.net[/url] | |
I have a database bound to a listbox but I would like to view only certain items, how to do that? It sounds like a really simple task but I don't know how to do it. | |
Re: [QUOTE=blud;1688646]Yeah, they definitely aren't up to spec with most enthusiast builds, but they are easily comparable to any computer you would find under $1k at a retail store.[/QUOTE] Except they're made to run Mac OS and Mac OS sucks, try maximizing a window or playing Quake III on it. Better … | |
If you're like me and enjoy Steam's service (not having to mess with DVDs and CDs), you may have purchased Skyrim through steam. Now if you're in the Americas and this category fits yourself, you might like to know all you need is an IP in a different country to … | |
Re: { case PC gaming: If the game supports my xbox 360 controller, I normally will use it. else, keyboard and mouse. case console gaming: not much choice } Recently I opted to upgrade my mouse & keyboard setup with a gameboard, it will arrive tomorrow and I'll let you know … | |
Re: Change endl to "\n" and work on your indentation instead of optimization. | |
Is there any reason I'm missing as to why not many languages let a programmer create a table of constant information at compile time? Something like: [code] public const Dictionary<string,decimal> SOME_DICT = new Dictionary<string,decimal>( {"A", 1.9}, {"B",2.3}, {"C", 4.4444} ); [/code] | |
Re: Wait what? Did I just hear the double quote is the escape sequence for quote? Whatever happened to: " \" " and " ' " ?? | |
Re: I think it's asking you to fix the loop such that it doesn't print multiple spaces here: [code] // are we on the border? if (r == 0 || r == rows - 1 || c == 0 || c == cols - 1) cout << "*"; else cout << … | |
Re: The gun law doesn't seem to be the issue, I support repealing the hughes amendment: [url]https://wwws.whitehouse.gov/petitions#!/petition/push-congress-repeal-hughes-amendment-fopa-and-nfa/FWXhjh9s[/url] The man knew what he was doing, it's his fault. Btw repealing the hughes amendment will make machine guns more affordable, currently you can get one but it will cost you thousands of dollars, … | |
Re: [QUOTE=crunchie;1646224]So, who plays Crysis2 multiplayer?[/QUOTE] Me! Man that game is beautiful, I bet BF3 will only be slightly prettier. Come to think of it I need some more RAM too. Other than that I have a small selection of Steam games, and I mainly play Counter-Strike: Source Beta. I would … | |
Re: [QUOTE=sknake;1044348]This morning: Now: So one new person cast a vote .. and 28 posts went down. Someone had a busy morning :) I suspect if this were looked in to you would find Rashakil Fol behind it. The number of unique down voters went up by one, and my negative … |
The End.