5,237 Posted Topics

Member Avatar for vertigovirgo

What's the difference between = and == Where are you using one, where you should be using the other?

Member Avatar for ddanbe
0
157
Member Avatar for TheBeast32
Member Avatar for mrnutty

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] << …

Member Avatar for Salem
0
115
Member Avatar for rad!anc3

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.

Member Avatar for rad!anc3
0
177
Member Avatar for ajay.krish123
Member Avatar for Salem
0
114
Member Avatar for Bhoot
Member Avatar for Bhoot
0
251
Member Avatar for Neo7
Member Avatar for Neo7
0
1K
Member Avatar for gcctest

Already answered on cprogramming.com Since you're new, read this [url]http://www.catb.org/~esr/faqs/smart-questions.html#forum[/url]

Member Avatar for Salem
0
62
Member Avatar for 000stephen
Member Avatar for karang
Member Avatar for Agni

> 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 …

Member Avatar for Salem
0
192
Member Avatar for shwick

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

Member Avatar for Salem
0
89
Member Avatar for Ragupathiyuva

[url]http://www.daniweb.com/forums/announcement118-2.html[/url] Perhaps show some effort by listing a few cases yourself first.

Member Avatar for Ragupathiyuva
0
102
Member Avatar for GadiK

Another approach to consider. [url]http://msdn.microsoft.com/en-us/library/aa365683(VS.85).aspx[/url]

Member Avatar for GadiK
0
2K
Member Avatar for Salem
Member Avatar for VernonDozier
0
141
Member Avatar for ItecKid

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? …

Member Avatar for ItecKid
0
134
Member Avatar for CoolAtt

> 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 - …

Member Avatar for Murtan
0
153
Member Avatar for ninja_gs

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]<<" "; …

Member Avatar for ninja_gs
0
141
Member Avatar for walsug

[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]?

Member Avatar for walsug
0
149
Member Avatar for bl@ck_d3ath-v2

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 …

Member Avatar for Salem
0
403
Member Avatar for ademsaykin

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 …

Member Avatar for VernonDozier
0
125
Member Avatar for mabpest

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.

Member Avatar for Salem
0
147
Member Avatar for shadwickman

> 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 …

Member Avatar for daviddoria
0
347
Member Avatar for Grub

I wonder who makes macintoshessssss....... [url]http://developer.apple.com/[/url] Nah, can't be that obvious, can it?

Member Avatar for Salem
0
107
Member Avatar for BigFormat

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]

Member Avatar for Salem
0
66
Member Avatar for nschessnerd
Member Avatar for daviddoria

> sprintf(pos, "%05d", 1); Only that you forgot to count the \0, and it's trashing something else.

Member Avatar for grumpier
0
224
Member Avatar for laki234

> 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.

Member Avatar for Salem
-1
97
Member Avatar for chris5126

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.

Member Avatar for Fest3er
0
137
Member Avatar for monere

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]

Member Avatar for monere
0
84
Member Avatar for mybluehair
Member Avatar for keyser_soze

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".

Member Avatar for keyser_soze
0
150
Member Avatar for jasimp

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 …

Member Avatar for jbennet
0
229
Member Avatar for The Dude

> 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 …

Member Avatar for Jen0608
0
189
Member Avatar for dharma30
Member Avatar for Ameerah

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]

Member Avatar for Salem
0
124
Member Avatar for manish_fra
Member Avatar for spanigrahi_situ

> 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*

Member Avatar for Salem
0
2K
Member Avatar for mikeandyikes

[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 …

Member Avatar for mikeandyikes
-1
130
Member Avatar for arulbell

> 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?

Member Avatar for Salem
0
88
Member Avatar for didi00
Member Avatar for didi00
0
153
Member Avatar for ogi1989

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.

Member Avatar for Salem
0
181
Member Avatar for carson myers

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, …

Member Avatar for carson myers
0
260
Member Avatar for rborob
Member Avatar for namehere05
0
230
Member Avatar for raseel

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.

Member Avatar for raseel
0
186
Member Avatar for jt_murphree
Member Avatar for jt_murphree
0
199
Member Avatar for DimaYasny
Member Avatar for DimaYasny
0
141
Member Avatar for star100
Member Avatar for Ezzaral
0
118
Member Avatar for serkan sendur

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.

Member Avatar for cikara21
0
160
Member Avatar for raphkeu

What sort of help? If you were doing this in C (or your other favourite language), could you express the algorithms you would need?

Member Avatar for raphkeu
0
141

The End.