5,237 Posted Topics
Re: What's the difference between = and == Where are you using one, where you should be using the other? | |
Re: You're using a switch/case as an array subscript. Consider something like [code] char *suits[] = { "Hearts", "Clubs", "Diamonds", "Spades" }; char *ranks[] = { "Ace", "Deuce", "Three", // you get the idea } suit = rand()%4; ranCards = rand()%13; cout << ranks[ranCards] << " (of " << suits[suit] << … | |
Re: 1. main returns int, not void 2. Avoid single letter identifiers (with the exception of i,j as being ubiquitous loop variables). For example, o and 0 make for very unreadable code. | |
Re: Neither do we, until you tell us which OS and Compiler you're using. | |
Re: [url]http://www.daniweb.com/forums/thread163078.html[/url] Don't cross-post. | |
Re: I clicked on the C along the top, and found the C API.... Mmm, interesting.... | |
Re: Already answered on cprogramming.com Since you're new, read this [url]http://www.catb.org/~esr/faqs/smart-questions.html#forum[/url] | |
Re: You also need to print the result, say print "$_"; | |
Re: > char *my_char = new char[]; What does this do again? | |
Re: > Any clues why? Because you passed a POINTER to i. The main() thread exits, the i variable goes out of scope and another thread is looking down the barrel of a segfault. > also any general tips for writing good multi-threaded code are welcome. Well the first step is … | |
Re: Maybe you typed -s without realising? [url]http://wiki.linuxquestions.org/wiki/Useradd[/url] Maybe the defaults are broken, use -D to find out Or try usermod to set a proper shell | |
Re: [url]http://www.daniweb.com/forums/announcement118-2.html[/url] Perhaps show some effort by listing a few cases yourself first. | |
Re: Another approach to consider. [url]http://msdn.microsoft.com/en-us/library/aa365683(VS.85).aspx[/url] | |
[url]http://www.vnunet.com/vnunet/news/2232488/teacher-slams-linux[/url] | |
Re: Is this the small "doesn't work" because it no longer sorts? Or a larger "DOESN'T WORK" because the program crashes with some bizarre error message? I see a lot of scope for blowing the stack with the large number of large arrays on the stack. Does 32001 BY ITSELF work? … | |
Re: > the prob is that wen it reaches the end of file , it keeps on printing the last line. You ignore the return result of fgets() You could try detecting that - fgets() returns NULL - then sleeping for a while, in the hope the file will grow - … | |
Re: Please use code tags to post indented code. #include<iostream> #include<cstdio> //#include<conio> using std::cout; using std::cin; using std::endl; int main(void) { //clrscr(); int a[10]; int s=3; int i,j,temp; cout<<"\t\t *SORTING OF THREE ElEMENTS * "<<endl<<endl; for(i=0;i<s;i++) { cout<<"Enter the "<<i+1<<" Element: "; cin>>a[i]; } cout<<"\n\nBefore Sorting : \n\n"; for(i=0;i<s;i++) cout<<a[i]<<" "; … | |
Re: [url]http://cboard.cprogramming.com/showthread.php?t=110199[/url] [url]http://forums.devshed.com/windows-help-34/help-how-to-get-the-microsecond-precision-in-windows-577631.html[/url] Who are you, [URL="http://www.youtube.com/watch?v=mN7Xs9WVNBU"]the beach boys[/URL]? | |
Re: Sure, here you go [code=c++] #include <iostream> #include <string> using namespace std; int main ( ) { std::cout << "Enter a date" << std::endl; std::string input; std::getline(input); std::cout << "It's a Monday!" << std::endl; return 0; } [/code] It produces the correct answer 14.3% of the time. Which coincidentally, is … | |
Re: I agree with Vernon. > This is my first year and [COLOR="Red"]I want[/COLOR] to be a good C++ programmer.I dont get the arrays. > I would be very happy if [COLOR="Red"]you [/COLOR]could solve my problem. You're screwed then. You'll never be good at anything (even flipping burgers) without putting in … | |
Re: Try attaching a picture (as a PNG), like niek_e's reply to one of your earlier efforts. [url]http://www.daniweb.com/forums/thread157714.html[/url] A fair number of people can't even read .doc files. A still larger number of people have no interest in opening a file who's basic architecture is rife with virus opportunities. | |
Re: > why must C++ be so difficult/strict with this? Power comes with responsibility. Scripting languages have expressive power in that you can just write your solution without any care about how it works underneath. But your "I'll just return an array" will entail a hell of a lot of work … | |
Re: I wonder who makes macintoshessssss....... [url]http://developer.apple.com/[/url] Nah, can't be that obvious, can it? | |
Re: The POSIX portable way to do this is to use [url]http://www.rt.com/man/opendir.3.html[/url] and readdir() and closedir() Linux specific? Try this [url]http://www.rt.com/man/ftw.3.html[/url] | |
Re: > sprintf(pos, "%05d", 1); Only that you forgot to count the \0, and it's trashing something else. | |
Re: > can anybody give me the answer of this problem No, read the forum rules. Draw some trees (with and without great grandchildren), and figure out how you would approach the problem. | |
Re: Personally, I would just do [ICODE]awk '{print $2 / 1000000 }'[/ICODE] and stop worrying about just how good the maths is in the shell. Also, awk has printf() as well, so you've got really good control over the format as well. | |
Re: Post the code which shows the error message, not the near equivalent which does compile. > I tried to use an indexed string array clip1[30] (exemple clip[ 0]= "clip1.txt") but it did not work . At a guess. [ICODE]ifstream file1 ( clips[0].c_str(), ios::in|ios::binary|ios::ate);[/ICODE] | |
Re: [url]http://devpaks.org/category.php?category=Networking[/url] | |
Re: Your code is broken in both cases. [url]http://c-faq.com/expr/index.html[/url] and in particular [url]http://c-faq.com/expr/seqpoints.html[/url] As soon as you have undefined behaviour, then all bets are off. Anything can happen, including what you imagine to be the "correct answer". | |
Re: The last thing any government wants is for the crowd to start believing that the police will never shoot back, no matter how much you provoke them. Like all deterrents, it only actually works (as a deterrant) if you actually carry out the threat, and establish the credibility that you … | |
Re: > He also will undergo a psychiatric evaluation. Yup, faith is a mental illness - in all it's forms. Most people infected with the faith virus keep it under control (most of the time). But when it really takes hold, people just get locked up in the padded cells with … | |
Re: ASCII stupid question, get a stupid ANSI :D | |
Re: Well trying to track the answers on too many web-sites, which don't know what the others are saying will surely confuse you. [url]http://forums.devshed.com/c-programming-42/about-overloading-577429.html[/url] | |
Re: > Any one plz help me on this urgently? You've had 13 days to play with the code ArkM posted, and now you're trying to make it into OUR problem? [url]http://www.catb.org/~esr/faqs/smart-questions.html#urgent[/url] Ha ha ha ha ha *plonk* | |
Re: [url]http://www.catb.org/~esr/faqs/smart-questions.html#urgent[/url] [url]http://www.catb.org/~esr/faqs/smart-questions.html#noprivate[/url] I don't supposed it occurred to you to post your code and your error messages, and actually learn something. Perhaps the only lesson you've learnt this time is the need to plan ahead and start looking for some help a couple of days before the deadline, and not … | |
Re: > which one is effective one based on performance? Who's performance? Yours in the time taken to get something to work? User's performance in forms/hour completed? | |
Re: Any particular reason why we would want to look at that unindented mess? | |
Re: So what isn't working now? The counting? The average? The output stream choice? Here's a cookie > float a,i; What's i initialised to? Then read the manual page on how to use printf, and what type %d is for. | |
Re: Relative jumps are for small jumps, like you would use for if/else or loops. So if you're using a relative jump which is out of range, perhaps take a hint that the body of your code is too complicated. Or if you think it's still OK, then invert the test, … | |
Re: > 1st Apr 2005 > 2 Hours Ago Thick end of 4 years - what do you think? | |
Re: Start simple - write a program which just copies the file, one character at a time. Until you can do that reliably, there's no point trying to implement a crypt/decrypt, because you'll have no way to test it. | |
Re: I'd guess your code. Get better information by posting your actual code. | |
Re: [url]http://www.gnu.org/software/bash/manual/bashref.html#Arrays[/url] | |
Re: [url]http://www.daniweb.com/forums/announcement9-2.html[/url] | |
Re: Post a short example which doesn't seem to work. Did you remember the extern "C" bit around anything which needs to be compatible with C ? Nevermind - it doesn't have code tags, so I lost interest. | |
Re: What sort of help? If you were doing this in C (or your other favourite language), could you express the algorithms you would need? |
The End.