5,676 Posted Topics
Re: [QUOTE=Ptolemy;456139]>I disagree. You have to have all kinds of special code to get scanf() to work properly. Only if you aren't using scanf for what it was designed in the first place. When you have to write workaround code to get a function to work, you're using the wrong tool … | |
Re: [QUOTE=still_learning;456334]Is this an example of a recursive function?? Somebody on another forum helped me put this together, as I am trying to make a diamond shape out of asterisks. But he did not know if this was a correct way of using recursion. Can somebody just tell me yes or … | |
Re: [QUOTE=bran-chua;456402]All the expert, please help me, because my lecturer said this question is difficult, and nobody will do this. so, i want to proof to him that still got expert can do this question...Thanks[/QUOTE] And neither will we. I did this for my class 35 years ago, I don't need … | |
Re: Personally (and I'll get slammed for this :icon_wink:) I'd use [INLINECODE]printf[/INLINECODE]. It's designed for formatted output, rather than that convoluted [INLINECODE]cout [/INLINECODE]mess. | |
Re: Where to get Compilers: [url=http://www.codeblocks.org/downloads.shtml]Code::Blocks[/url] [url=http://msdn.microsoft.com/vstudio/express/visualc/]MSVC++ Express[/url] [url=http://www.openwatcom.org/ftp/]Open Watcom C++/Fortran[/url] [url=http://www.bloodshed.net]Bloodshed DevC[/url] [url=http://www.borland.com/downloads/download_cbuilder.html]Borland 5.5[/url] [url=http://bdn.borland.com/article/21751]Turbo 1.01[/url] [url=http://bdn.borland.com/article/20841]Turbo 2.01[/url] [url=http://148.231.149.200/aplic/tc30.zip]Turbo 3.0[/url] [url=http://msdn.microsoft.com/vstudio/express/vb/]Visual Basic[/url] [url=http://realbasic.com/]Real Basic[/url] | |
Re: [QUOTE=Ptolemy;455607]>Haven't you figure out yet why you should avoid using scanf? I don't think you should avoid scanf. I think you should learn how it works so that you can use it intelligently.[/quote] I disagree. You have to have all kinds of special code to get [I]scanf()[/I] to work properly. … | |
Re: #1: [B]Never[/B] bump your messages!!!! People will respond when they see it, and 5 hours is not a long time. #2: If all [I]Basics[/I] are so similar, there is no detail needed. And since you already know they are similar, why are you asking? And where do you get your … | |
Re: Details. What works? What doesn't? Specifically what is your problem area? | |
Re: [B]Salem[/B]'s request is to repost your code [B]with[/B] [url=http://www.gidnetwork.com/b-38.html]formatting[/url] and [url=http://www.daniweb.com/techtalkforums/announcement8-3.html]Code Tags[/url]... When we can read the code, we can help. | |
Re: Define a value for each of the 8 directions: 1-up 2-down 3-left 4-right 5-up/left 6-up/right 7-down/left 8-down/right Then get a random number to decide which direction to choose. Randomly choose a starting location and see if the word will fit 1) enough space in the chosen direction 2) any letters … | |
Re: Last for me was Conan! On the big screen, too! Great movie. | |
Re: [INLINECODE]if (islower(x))[/INLINECODE] can be written [INLINECODE]if (x >= 'a' and x <= 'z')[/INLINECODE] | |
Re: Each letter (in fact each character) has a specific numeric value. Each character can therefore be used as an index into an array in which you can increment the appropriate element. Then run through the array when done and output the values you need. Unzip and run the attached program … ![]() | |
Re: Start by writing a program that accepts parameters on the command line and prints them out. Once that's working, check the parameters to see what they are and output messages for each so you know you are analyzing the parameters correctly. Then open the file, read it, and display it. … | |
Re: So why can't these 40000 people be deleted? Or is the number helpful in marketing the site? ![]() | |
Re: You should not be opening the same file for reading and writing. Use [inlinecode]fout[/inlinecode] to write each line read (changed and unchanged) to a new file. When done, delete the old file and rename the new file. Also, [url=http://www.gidnetwork.com/b-58.html]read this[/url] about [inlinecode].fout()[/inlinecode] (which is identical to [inlinecode]feof()[/inlinecode]. | |
Re: [QUOTE=Ancient Dragon;453767]If you want to store mixed data than I'd use a structure that has two members: (1) a union between all the data types you want it to support, and (2) an int that indicates what kind of data is stored, such as 0 no valid data, 1 is … | |
Re: [QUOTE=tracethepath;453260]hmm...u dont know the arrays part... i think u cn try this.. . . . hope dis is of sum help[/QUOTE] [QUOTE=tracethepath;453266]sorry i did sum mistake in d above program... below is the corrected one n its working perfectly... . . . i hope it is of sum help...!!![/QUOTE] [B]Trace[/B], … | |
Re: #1) You can't use [I]strcat[/I] on [B]strings[/B]. Only with [B]char*[/B]. Look up [B]string[/B] methods. #2) Break the following line into pieces to create the file name and output it so you know it's correct before using the [I]open[/I] function. It's also less confusing. [INLINECODE]infile.open(strcat(strcat(st1,(strcat((string)i,st2))),ios::in) [/INLINECODE] #3) [url=http://www.gidnetwork.com/b-58.html]Read this[/url] about the … | |
Re: How many threads are we working with for this program? Maybe you should have only one thread so no one gets confused. Especially you. | |
Re: Decimal places require [B]float[/B] or [B]double[/B] variables. | |
Re: [QUOTE=gator6688;452997]The program will stop if any other integer is entered except 1-4. My next question is this. Is there a way to ask the user to reenter the number instead of just ending the program?[/quote] Yes. You put the input in a [I]while[/I] loop and don't exit the loop until … | |
Re: [QUOTE=Salem;452727]And would it kill you to use some indentation (or indeed any white space).[/QUOTE] Exactly. [url=http://www.gidnetwork.com/b-38.html]Study this[/url]. | |
Re: Why is [I]LetterToMatch[/I] defined as an array of one [I]char[/I]? Why not just define it as a [I]char[/I] and it won't be a pointer, correcting some of the errors. | |
Re: Is there something about the background text you didn't understand on the input box. or the [B][I]Read Me: Read This Before Posting[/I][/B] link at the top of the forum? | |
Re: Write another function that simply prints out the double values by converting to ints. Then at all places you output the values, call the function instead. | |
Re: So [B]Clinton[/B], what was the purpose of your post? How does it help [B]sneha_venky[/B] with figuring out a project to program? | |
Re: [QUOTE=gator6688;445819]Can someone tell me what i'm doing wrong:[/QUOTE] Depends on what you're trying to do, what it actually does, and what it's supposed to do. [QUOTE=gator6688;445819]Can someone tell me what i'm doing wrong:[/QUOTE] [url=http://www.gidnetwork.com/b-38.html]Formatting[/url] for one. Explaining nothing for two. Not posting errors for three. [url=http://www.daniweb.com/techtalkforums/thread78223.html]Read this[/url] for further help. | |
Re: [QUOTE=jrice528;445325]I read in the binary form "011010"[/quote] As a [I]string[/I] or a [I]number[/I]? [QUOTE=jrice528;445325]I having trouble getting it into digits, [/quote] This depends on the answer above. [QUOTE=jrice528;445325]and assigning that digit the value in decimal form.[/quote] Explain what [I]decimal form[/I] means -- with an example. It would really help if … | |
Re: [QUOTE=Ancient Dragon;445713]not necessary, just declare another int named [b]count[/b] , initilize it to 0, then increment it in that loop maybe something like this: [code] for (i=0; i < MAXGRADES; i++, count++) [/code] Then replace [inlinecode]for (i=0; i<MAXGRADES; i++)[/inlinecode] with this [inlinecode]for (i=0; i<count; i++)[/inlinecode][/QUOTE] Or to make it simple, … | |
Re: Look closely at one of the errors: error C2664: 'read_data' : cannot convert parameter 1 from '[B]double[/B]' to '[B]double [][/B]' The prototype says: [code] int read_data(double angles1[],double angles2[]); [/code]The first parameter requires an [I]array of doubles[/I] When you call the function: [code] int numpts = read_data(angle1,angle2); [/code] what type of … | |
Re: Your problem is using the wrong way to test for the end of a file: [CODE]while ( !myfile.eof() )[/CODE] [url=http://www.gidnetwork.com/b-58.html]See this[/url] ([INLINECODE]feof()[/INLINECODE] is the same as using [INLINECODE].eof()[/INLINECODE]) | |
Re: [QUOTE=zandiago;442356]The assignment is : This is so crazy, here is what I've got so far: [/QUOTE] So what is it you need help with? You need to ask a question so we know what you need help with. Just posting unfinished code and the assignment says "finish this for me, … | |
Re: [QUOTE=nsesem;444513]i do need help..someone to help me et tell what to do? thanks[/QUOTE] Sure... [url=http://www.daniweb.com/techtalkforums/thread78223.html]Read This![/url] | |
Re: A couple problems with your functions: [CODE=c] int readBig(int[]) // what's the variable name being passed in? { // same with addBig() string num; int n[MAX_DIGITS],i; cin>>num; for(i=0;i<MAX_DIGITS;i++) // what if you enter less than MAX_DIGITS digits? { n[i]=num[MAX_DIGITS-1-i]-'0'; cout<<"n["<<i<<"]"<<n[i]<<"\n"; } // This is an INT function -- you must … | |
Re: It's because [B]cin >>[/B] leaves junk in the input buffer when the command is finished. Use [B]getline()[/B] instead, but you will have to remove the trailing '\n' that's in the string you read, which is an easier problem to deal with, IMAO. | |
Re: As a simplistic explanation, each time you call the recursive function, a [I]new[/I] copy of the function is created, including new variables. The values of the variables in the previous copy are not destroyed, so when the new function returns, the values are as they were before the call was … | |
Re: So why not use [code] cout << "The first and third letters in the entered words are: " << static_cast<unsigned char> list[1][1] << list[1][3]; [/code] to display the 1st and 3rd letters of word #2? | |
Re: [QUOTE=megan-smith;442598]hey there; i wanted to write a program to convert binary to decimal. i did that using the " character approach". it works just fine. then i decided to enhance the program by adding an error message whenever the input are invalid (i.e anything other than 0, 1 ), but … | |
Re: [QUOTE=gator6688;442602]Any suggestions? Anyone?[/QUOTE] Yes. 1) Use code tags as explained on the background of the box you typed you messages in, as well as in [url=http://www.daniweb.com/techtalkforums/faq.php?faq=daniweb_policies#faq_keep_it_organized]the Forum Rules[/url] 2) Don't bump your threads. It's rude, and most of us have lives outside of DaniWeb. We'll get to your problem when … | |
Re: Since 'A' is the internal value 65, 'B' is 66, 'C' is 67, and so on, subtracting 'A' from your letter will give you 0, 1, 2, and so on. Therefore: [code] int idx; int notalpha=0; int nchar[26]; for (...) char[i] = 0; //set each char to 0 while (c … | |
Re: [url=http://www.gidnetwork.com/b-44.html]This[/url] may help. | |
Re: [QUOTE=royaloba;284714]Veena, thanks, you've solve my 2nd problem, but still my main problem is if i will download all the attendance from the reader it will save only in one file..this is the sample output file... the file name is base on the date i download the file...12052006.txt it should be … | |
Re: [QUOTE=ziz_300;440284]well in the function "add" I want to add "b" to the specified number, and in the function "deal" I want sign "y1" to "b" in "add", so that "y1" will also be added to the number, and the same thing goes for "y2". but if I put in function … | |
Re: Here at [B]DaniWeb[/B], we perfer to: 1) use code tags when posting code 2) read the rules so you know how to post 3) not give ready-made programs but help people learn how to program 4) post [I]good[/I] code when helping, not bad code, like: [url=http://www.gidnetwork.com/b-43.html]getch()[/url], [url=http://www.gidnetwork.com/b-66.html]void main()[/url], [url=http://www.gidnetwork.com/b-38.html]proper formatting[/url], … | |
Re: [INLINECODE]strstr()[/INLINECODE] does not work on [INLINECODE]string[/INLINECODE] class, only [INLINECODE]char*[/INLINECODE]s. Look at the [url=http://www.cprogramming.com/tutorial/string.html]string class[/url] methods to find your substitute function/method. | |
Re: [QUOTE=rjc;435695] basically, when i try to insert a number for minutes, such as 73.5, it will say 1 hour and 13 minutes late, leaving off the .5 .....thank you for all your help[/QUOTE] First of all, why would you want to keep track of .5 minutes? Make them all [INLINECODE]int[/INLINECODE]s, … | |
Re: [QUOTE=maverick786;432618]I am having trouble formatting my output of decimal to binary conversions...[/QUOTE] Wouldn't it be beneficial to let us know what kind of problem you are having? The output you posted is correct. | |
Re: [QUOTE=zite.1;433158]can someone tell me how to find dummy tutorials on how to compile and run C programs using a text editor and the Command Line Window.[/QUOTE] You don't really need one. Type in the command you use to edit a program. When the program is ready, type in the command … | |
Re: [B][I]another error need help please[/I][/B]??? Is that the type of title suggested by the [B]Read This[/B] thread at the top of the forum? And is the information you gave adequate for our understanding, as the same post suggests? |
The End.