447 Posted Topics
Re: Or if you don't want the whole screen to clear, only the line with the number on it:[code]for ( int i=0; i<100; i++ ) { std::cout<< "\r" << i << "\t"; Sleep( 100 ); }[/code] \r goes to the start of the line, assuming you're printing to the start of … | |
Who doesn't like a good quote from time to time? Anyone got any good ones? I like this one from Contact: First rule in government spending: why build one when you can have two at twice the price? Man, that movie's over ten years old now... weird. | |
Re: Wrap your code in code tags [noparse][code][/code][/noparse], but put in a language specifier, like so: [noparse][code=c]CODE GOES HERE[/code][/noparse] or [noparse][code=cpp]CODE GOES HERE[/code][/noparse]. The latter gives:[code=cpp]CODE GOES HERE[/code] | |
![]() | Re: The simplest thing I can think of is to use some kind of pop3 library... I'm sure there are probably some available. ( first hit -- [url]http://www.marshallsoft.com/see_4c.htm[/url] No idea on how good it is ) If not I reckon you should be able to do something with libcurl ... I'm … ![]() |
Re: I'm glad you put in the last line in the thread. But I, for one, would like to see some work before helping. Just to see where you are so the advice I'm giving isn't redundant. | |
Re: >> gets(p->name); Bad. Seeing as you're using C++ (noticable only from the *& in [inlinecode]insert[/inlinecode]), you can use [inlinecode]std::getline[/inlinecode] and [inlinecode]std::string[/inlinecode]s. Also in C++ one does not need to [inlinecode]typedef[/inlinecode] [inlinecode]struct[/inlinecode]s. >> main() [inlinecode]main[/inlinecode] returns in int: [inlinecode]int main()[/inlinecode]. Also, good idea not to allow the users to quit. | |
Re: Ever wonder why there aren't any babies in the north during the winter, vegaseat? My experience was much like what you'd expect Atticus Finch to say. And I was more confused after asking. I asked, as far as I remember, cause there was a big rape case on the news … | |
Re: I'm kind of ambidextrous. I've been taking notes in class with my left hand for the last... 4 months. I'm not certain why, but I am certain that when it comes to exam time I'll curse the day I decided that was a good idea. | |
Re: >> scanf("%c%c%c%c",&a,&s,&d,&f); >> if ((a=='a')&&(s=='r')&&(d=='c')) >> else if ((a=='l')&&(s=='i')&&(d=='n')&&(f=='e')) I'm guessing you don't know about using character arrays then? Take a look [URL="http://www.cplusplus.com/reference/clibrary/cstring/"]here[/URL]. Ones to note are [URL="http://www.cplusplus.com/reference/clibrary/cstring/strcmp.html"]strcmp()[/URL] and look into scanf-fing with[inlinecode]%s[/inlinecode]. >> system(); What's that there for? >> for(yf==yl1;yf<=yl2;yf++) The first parameter in a for loop is meant … | |
Re: Not certain why you had to start another thread either. Basically the same problem as [URL="http://www.daniweb.com/forums/thread105141.html"]last time[/URL]. | |
Re: With the architecture you provided you don't need any set member function. You can access the variables by using . [code]class Name { private: int id; string lastName; string firstName; string phone; double amt; public: void output(); void set(int, string, string, string, double); };[/code]I believe is what you were meaning? … | |
Re: Easiest thing to do, from experience, is to download [URL="http://www.videolan.org/vlc/"]VLC Media Player[/URL] and read up about its networking functionality. | |
Re: This was asked in another forum I go to and I came up with the following: [B]Reading contents of a file directly to a vector[/B][code=cpp]#include <fstream> #include <vector> #include <string> #include <algorithm> int main( void ) { std::ifstream in( "shorts.txt", std::ios::binary ); if ( in ) { std::vector< short > … | |
Re: You should post some code to show us that you've tried something. Generally we're a lot more helpful if we see some effort... | |
Re: Found a floppy with [URL="http://en.wikipedia.org/wiki/Battle_Chess"]Battle Chess[/URL] on it the other day. After searching for a drive for it I copied it to my computer and it works. I've been playing nothing but that. | |
Re: I really don't know what you mean. Do you want to save integers to file? Binder? | |
Re: I find it infinitely annoying... and I can't get it out of my head... It's like a very well designed advert. I heard that they are [I]meant[/I] to annoy you... I probably wouldn't hire that guy from that CV. I just couldn't take him seriously, you know. | |
Re: [code]#include <cstdlib> int main( void ) { system( "dir>output.txt" ); return 0; }[/code] | |
Re: I'm not certain but I know that a new kind of solar panel was invented recently which makes solar energy as cheap as coal to buy. Good quality panels have been really expensive up to now. It's not the cost you want though, Dave. I can buy [I]loads[/I] of one … | |
Re: You won't read in a sentence with "cin>>". Use [code]#include <string> //... string str; getline( cin, str);[/code]Plus the a you used is an integer... >> struct letteroccurance >> { >> char letters[]; >> int occurance[]; >> }; That won't do. Just make the counter 26 elements wide... You don't need … | |
| |
Re: Do you know how to write one for a terminated list? It's not all that bad. At the root just set the 'previous' to NULL, and set previous->next to NULL and go through it until you reach NULL. Alternatively you could use auto_ptrs or something. | |
Re: >> char main() Interesting... Guess it's not as bad as void... | |
Re: I'm normally placid. Not sure if any of the above actually offend me ... just annoy me. >> I think face-sucking in public is offensive Why? This reminds me of a quiz I was at before. There was a question about the irrational fear of clowns and I was thinking … | |
Re: Burn for cheap heating? I haven't been programming that long and only have... well no books... Generic presents to people you don't like. | |
Re: Well, this is heavily dependant on your OS and compiler.. this works in XP and MSVC .NET 03: [code=c]#include <windows.h> #include <Iphlpapi.h> #pragma comment ( lib, "Iphlpapi.lib" ) static void GetMACaddress(void) { IP_ADAPTER_INFO AdapterInfo[16]; // Allocate information // for up to 16 NICs DWORD dwBufLen = sizeof(AdapterInfo); // Save memory … | |
Re: [code]void foo( int val ) { val = 1; }[/code][code]void foo2( int &ref ) { ref = 1; }[/code]First is by value, second is by reference. You can change the value of 'ref' in foo2 by setting its value and the value will change outside the scope of the function, … | |
Re: I'm pretty sure you're making that up, or at least mistaking it. Do you have a cin.ignore() or cin.get() or something before the function is called? Also, you should use std::string to read in the file and getline(). It makes it much easier... Also work with lines rather than characters. … | |
Re: Use [inlinecode]std::stringstream[/inlinecode] or [inlinecode]using namespace std;[/inlinecode] Stringstreams are part of the [inlinecode]std[/inlinecode] namespace. Dragon just forgot to insert it (old age, you know ;)) | |
Re: You're wrong, Dude. Red all the way! I had an amazing one with an amazing steak a few months back. It was then that I discovered that the more you pay for wine the nicer it actually gets! I honestly never tasted the difference before. But red. I'm sure if … | |
Re: >> So is there any way I can get rid of the initial argument? You could just make it a friend function ... [code=cpp]template< typename mis_type > class missle_man { protected: std::vector<mis_type> vms; public: template< typename mis_a, typename mis_b > friend bool is_coll( const mis_a &missle_a, const mis_b &missle_b ); … | |
Re: I dunno... when I was a kid (R are like 18+, right), I used to like watching those films cause I thought it made me ... more ... cooler, or something. Then when I became old enough to watch them ... meh. They lost their appeal. Now I just watch … | |
Re: I voted yes, but not recently! The last time I remember doing it was when I was 13. I was in a French grammer test and I hated French. I learnt those LORT/Hobbit runes for it especially and wrote the French-equivalent on my school bag! It was premeditated cheating which … | |
Re: Is the data formatted as above? With each signal on a new line? It should be easy enough to parse then... How many time stamps are there? | |
Re: >> hey, don't underestimate my colleagues! I take it you know that the Irish secret-intelligence is so secret that not even the government knows about it, right? >> I won't embarrass the unit or the female Lance Corporal involved by naming names i.e. a "close aid to the president", i.e. … | |
Re: Well, by playing with the code from the link I got this: [code] #include<windows.h> #include<stdio.h> #include<conio.h> #pragma comment(lib, "Winmm.lib") //command, note, velocity #define MAKE_MSG(X, Y, Z) (X + (Y<<8) + (Z<<16)) #define NOTE_ON 0x90 #define NOTE_OFF 0x80 int main(void){ HMIDIOUT x; if(midiOutOpen(&x,-1,NULL,NULL,CALLBACK_NULL)!=MMSYSERR_NOERROR ){ printf("ERRORS ahoy\n"); } midiOutShortMsg(x, MAKE_MSG(NOTE_ON, 62, 65)); … | |
Re: >> Wow, 6 foot tall and weighig 133 pounds, that is rather skinny. I am 6 foot 3 inches and weigh close to 200 pounds. So one inch is about 22 pounds... I am 5 10/11 ish... so I'm 1573 pounds... that's not right. | |
Re: >> I like Salem's too. Very original and thought provoking Yeah. I've been meaning to borrow that for another programming (embedded device), forum where one uses "void main()". Thought it would be amusing. Hehe. Google-image search "Salem" for small pictures. Daniweb is the first hit. | |
Re: I thought it was a good idea to go for a swim at the stroke of midnight... but apparently I have a cold now, so maybe not. Then I went for another on the 26th... Seems to have cured the first one but I have another now... | |
Re: At home, then to a friends for whiskey, then to the sea for a cold swim, and then more hot whiskey... or port. | |
Re: I like cigars cause I'm pretentious. Also brandy goes nice with them. | |
Re: Is there any way you can keep track of the current position? If there is you can multiply that by two because, as you stated, you know you can't multiply the pointer by two. However, one can do multiplication via addition. | |
Re: While I agree with ye I also agree with MacBeth: "Who can be [URL="http://www.selfknowledge.com/108260.htm"]wise[/URL], amaz'd, temperate, and furious, Loyal and neutral, in a moment? No man:" | |
The End.