5,676 Posted Topics
Re: Create an 'input form' that looks like an InputBox. For every character hit, save it and replace it with '*' in the TextBox of the form. | |
Re: You need to look up how to translate [B]infix[/B] (normal a+b) notation into something like [B]reverse polish notation[/B] (ab+). RPN makes it easy to calculate an equation. But the translation into RPN is a little harder. Especially when parentheses are part of the equation. See [url]http://www.google.com/search?q=infix+to+reverse+polish[/url] | |
Re: A couple things on your statement [CODE]while(fscanf(in,"%s %s %s\n,",&day,&mon,&year)>0)[/CODE] 1) you don't need the &. Each variable is already a pointer since they are arrays. 2) [B]>0[/B] is OK if only one of the values is needed. Use [B]=3[/B] if you want all values to be correctly entered. | |
Re: Sound to me as if you either 1) haven't explained what you're trying to do properly (I'm lost) 2) haven't designed the concept well enough to start programming. Having a timer for SECONDs and another for MINUTEs shows you haven't thought through the task. Based on what I understand, you … | |
Re: Agree. Also, [url=http://www.gidnetwork.com/b-57.html]see this about fflush()[/url] | |
Re: Well, yeah, why would you want to [ICODE]realloc()[/ICODE] one character at a time? Add 512 bytes at a time. | |
Re: [QUOTE=VernonDozier;] Hence your "Big-O" time goes from about "n-squared", which is about what it is for Nichito's method, to "nlogn" for mine (basically the time it takes to do just the sort). [/QUOTE] But you're forgetting the 'time' it takes to do the sort itself. You need to add that … | |
Re: That completely depends on what the prof wants. He's the best one to ask. My gut feeling is no, just flowchart first, second, and last. | |
Re: After you get the ones digit, divide the number by 10. Now the tens digit is ready for the %. | |
Re: [QUOTE=mike_2000_17;]The bound that you use on the loop is not correct. "length" is the total number of characters in your memory buffer, it is not necessarily the number of characters that was read with fgets from the file. C-style strings are terminated by a null character. So, you should add … | |
Re: You'll have better luck with some explanation, not just posting code and asking us to figure out what it does. Pinpoint as close as you can [I]where[/I] the problem seems to be, and what the crash circumstances are. Basically, what you have here is the same as taking your car … | |
Re: Seems to me that you need to give us a specific code sample and explain what you are asking. Most of what you said is confusing and (I believe) wrong. But because it's confusing I'm not sure. | |
Re: [QUOTE=Wheaties;1501079]An array is any size, say 5000 indexes. If I input a 500 via some function, then my array will have 4500 null spaces hence forth and 500 valid spaces with which to plug numbers into later in the program. Is such a thing possible? [/QUOTE] Of course it is. … | |
Re: Can't follow the code with the lack of formatting. [url=http://www.gidnetwork.com/b-38.html]Please format it[/url] and repost. | |
Re: [QUOTE=satti;1500287]@Monarchmk u r right, i think we should leave him ...[/QUOTE] Not only that, but giving free code away is frowned upon. If they can't post their code, how can they understand your code? | |
Re: And why did you post this question in a thread from 3 years ago about a roulette wheel? | |
Re: [CODE] start = 10; // start writing at byte #11 bytewritten = fwrite(&buf[start],1,payload-start,fp);[/CODE] [iCODE]&buf[start][/iCODE] is the address of the 11th byte | |
Re: Is there something about the sticky post at the top of the forum titled [url=http://www.daniweb.com/software-development/cpp/threads/90228][B][I]Read me:[/I] How do I flush the input stream?[/B][/url] that you don't understand? | |
Re: Reread [B]Mike[/B]'s post and answer his questions. He asked the for a reason. | |
Re: Your loop states [iCODE]while (notas[x]>100 && notas[x]<0);}[/iCODE]. Can this ever be true? Read your condition very carefully with [I]notas[x][/I] qual to -10, 50, and 110. Write out a truth table to see what happens. | |
Re: [QUOTE=efronefron;1499171]In my system, which is ubuntu, fflush doesnt do anything. Ive tried using fflush(stdin) and it doesnt really flush anything, the characters in stdin are still there. fflush doesnt do anything in my system,its just like another empty line.[/quote] That's because the standard states [ICODE]fflush()[/ICODE] is only required to work … | |
![]() | Re: It will happen automatically. |
Re: [QUOTE=Fbody;1499097]Posting code isn't the problem. It's the situation and type of code posted. [URL="http://www.daniweb.com/forums/announcement8-2.html"]Read this.[/URL][/QUOTE] Yes, as [B]cscgal[/B] says: [QUOTE=cscgal]Though we are all here to help, please don't expect quick solutions to your homework. We'll help you get started, exchange algorithm ideas, how-to's, etc. but only if you show that … | |
Re: 1) It isn't, really. Reference param passes the address into the function rather than the value. 2) Yes 3) [b]new[/b] doesn't store anything. It defines space and puts the address of that space in the variable specified. Consider variables as boxes you store stuff in. Each box can hold a … | |
Re: All you need to know about rand can be found [url=http://www.google.com/search?q=c%2B%2B+rand]here[/url]. '3' is a character, "3" is a string. [I]cout[/I] simply outputs what it is given, so in the example you mention, there is no real difference. They are essentially identical. | |
Re: Error #1- You didn't use CODE Tags Error #2- You didn't bother to tell us what the error you're talking about is. This isn't the [I]Psychic Homework Help Desk[/I]. | |
Re: You really want us to look through 650 lines of code to 1) find you compare function? 2) figure out what's wrong? Sorry, nope. Pinpoint the problem areas and we can see what we can find. | |
Re: Problem #1: [ICODE]switch(inst[50])[/ICODE] -- this command only checks the value at [I]inst[50][/I], which is the byte one past the end of the array [I]inst[/I]. What are you trying to test here? Problem #2: [ICODE]case 1:[/ICODE] -- You entered characters, not integers, and this [I]case[/I] is an integer value. [quote=Khoanyneosr] Is … | |
Re: To avoid this problem in the future, compile often. Write the basic code framework first (includes, main(), return) and compile. Write a class and compile. Make sure it compiles clean. Write the next class and compile. Write a function and compile. Keep adding and compiling, fixing any errors immediately as … | |
Re: Each character has a numeric value 'A' = 65 'B' = 66 '0' = 48 '1' = 49 and so on. Subtracting '0' subtracts 48, so [Icode]'2' - '0' = 2[/Icode], equivalent to [iCODE]50 - 48 = 2[/iCODE] Now look at the code you posted. Does that shed any light … | |
Re: The code you posted cannot display the output posted. The simple solution is use a FOR loop. | |
Re: [QUOTE=sreekiranws;]Hello I need some help as to the limitations or flexibility of header files. I have written a code that updates a base folder when it is compared to its newer version. I have hit on a roadblock though. If a new file is added to the folder, the program … | |
Re: Where did you learn that [iCODE]if(menuinput == (l || L))[/iCODE] is a valid IF statement? You need to look up how a compound statement is written. And what's the purpose of assigning [iCODE]l = 'l';[/iCODE] and [iCODE]L = 'L';[/iCODE] just to use variables in the IF statement? Use the characters … | |
Re: Change your browser's font to one that uses different characters for the letters. | |
Re: [QUOTE=aqnie;1494612]hey I am new in C++ and I have finished my code but my Prof. asked me to write pseudocode and I have no idea what that is and I dont know how to write it.[/QUOTE] Well, in my opinion, you should have ask him this when he told you … | |
Re: Back to probability. You need to use [iCODE]srand()[/iCODE] and [iCODE]rand()[/iCODE] to get your probability. Get a random number between 0 and 99. If the number is 30 or more the record is OK. If < 30, reject it. | |
Re: Now clicking on the thread icons no longer goes to the unread posts. Even after ^R. | |
Re: If [I]source2.c[/I] doesn't need anything in [I]library1.h, library2.h, another.h, etc.h[/I], why include them? As [B]L7Sqr[/B] said, it's just noise. The compiler is doing work for no gain. | |
Re: Read the entire line. Check the characters looking for a letter. That's the beginning of the name and the end of the account number. Next check looking for a digit. That's the beginning of the address and the end of the name. Etc... | |
Re: Yes. [iCODE]strstr()[/iCODE] in [I]string.h[/I] | |
Re: Would you mind explaining how you 'save' numbers? It's so much faster than trying to understand 452 lines of code. | |
Re: First thing you need to do is understand both languages well and understand the grammatical rules for each language then be able to tell what translates to what from what I see in your post you do not understand english well enough to tackle a program like this you need … | |
Re: Follow your post as if it were a map of your program. You've got it all there and in an order you can use. | |
Re: Let's start with these two functions first: [QUOTE=beejay321;]• int lastDig(int num); This function returns the last digit of num.[/quote] If you pass in the value [B]100101101[/B] this function will return [B]1[/B]. You can do this using the modulus ([B]%[/B]) operator. [QUOTE=beejay321;]• int removeLast(int num); This function returns a number without … | |
Re: Or if stringstream is too advanced, [iCODE]atoi(argv[i])[/iCODE] will also suffice. [B]i[/B] will be an index into the [B]argv[/B] array. | |
Re: No error message, just crashes? Nothing to give you an indication why? That's really strange. Try to pinpoint what statement causes the problem. | |
Re: Depending on your O/S, look up the system's [I]Execute[/I] functions. There should be one that allows you to execute Program 1 and wait until it exits. Other option is to run Program 1 and just before it exits, start program 2 with [iCODE]system()[/iCODE] | |
Re: Put the [iCODE]srand()[/iCODE] functionn call back in [iCODE]main()[/iCODE]. And where's the header that define the random functions? | |
Re: [QUOTE=chess2009;]Hi When you ask for a person to write what code he/she has written and then ask questions based on his/her code other people can simply copy and paste his code.[/QUOTE] That is true... [QUOTE=chess2009;]That is called COPYRIGHT.[/QUOTE] No, that is not copyright. Copyright is a legal status of intellectual … | |
Re: 1) Please [url=http://www.gidnetwork.com/b-38.html]format your code[/url] so we can read it properly. 2) Do not use [iCODE]gets()[/iCODE], [url=http://www.gidnetwork.com/b-56.html]here's why[/url]. 3) [iCODE]main()[/iCODE] is not a [I]void[/I] function. [url=http://www.gidnetwork.com/b-66.html]See this[/url]. 4) To get help, you need to show an attempt. There is no attempt in this code for 4 & 5. |
The End.