5,676 Posted Topics
Re: Can't see your code. Can't tell what might be wrong. | |
Re: [ICODE]for(j=1;j=n;j++)[/ICODE] You are not comparing j with n, you are setting j to n, therefore an infinite loop. You need to think deeper about what you are trying to accomplish. Use pencil and paper to figure out what kind of loops you need, and how many. | |
Re: VB6 is probably no longer available, but VB-Express 2008 can be downloaded from [url=http://www.microsoft.com/express/Windows/]here[/url] | |
Re: If you guys bothered to look at the code you might have noticed in the original post: [CODE]/* Global variable Declarations. You may not include any additional global variables */ int cntLetters[NUM_LETTERS], totalLetters; char cipherText[BUFSIZE]; [/CODE] I wonder what [I]cntLetters[NUM_LETTERS][/I] is for? | |
Re: [QUOTE=rgpii;1162171]If I pass match[100] as an argument , doesn't that make it just the value at match[100]. I thought I the proper way to pass an array as a function argument was a match[]. I assumed this was a pointer to the first element and it could be modified accordingly. … | |
Re: Then you aren't reading a \n. After reading the character, immediately display it's binary value [iCODE]cout << (int) nextchar;[/iCODE] If you don't see the value of '\n', you aren't reading it. | |
Re: And I'm the second one to agree with [B]FBody[/B]. Do you still think he's wrong? | |
Re: [QUOTE=jephthah;1160232]scanf is often the source of input problems. as you can see, you have the most trivial example and it's [I]already[/I] being problematic. since there are better alternatives readily available, you'll do well to learn to stop using it as soon as possible.[/quote] While you are bashing [ICODE]scanf()[/ICODE] and [ICODE]gets()[/ICODE], … | |
Re: What serial number? How is it formatted? How does the subroutine get it? | |
Re: After you test for EOF, test for an invalid character. If you got one, clear the rest of the input buffer and return 0. | |
Re: If you need to get the command, why do you [B]skipOverRestOfCommand()[/B]? Why are you throwing the command away? Save it and [B]returnTheCommand()[/B] instead. | |
Re: Way way too complicated... Input the two numbers like you did. To print the even numbers, just use a for loop that goes from [B]Number1[/B] to [B]Number2[/B] incrementing [B]i[/B]. If I%2.... Same with the odd numbers. | |
Re: Use [ICODE]strlen()[/ICODE] since you are entering characters. | |
Re: [QUOTE=Kombat;1161239]How can I do this? (I know in gcc its a.out < input.txt);[/QUOTE] It's the same on the Windows command line. | |
Re: [QUOTE=apegram;1153659]What if the Queen is overthrone beforehand? Hmmm?[/QUOTE] Is she a drinker? Maybe she'll be underthrone. ![]() | |
Re: [QUOTE=sganesh;1160406]you can do this in scanf itself, [code=c] scanf("%10s",Name); [/code][/QUOTE] No, don't. Getting used to using [ICODE]scanf()[/ICODE] for strings is dangerous because it is too easy to use it wrong. And there is [ICODE]fgets()[/ICODE], which is safer all 'round. | |
Re: There certainly isn't enough information in your description to even make an educated guess. Maybe you need to use a debugger to follow the program through the printing section. Also, if you'd consider using arrays, you can remove all those [iCODE]if[/iCODE] statements and make your code smaller and a little … | |
Re: [QUOTE=jephthah;1159873]i dont know how to explain this any better, without resorting to code. here it is 'explained' in pseudocode first problem: [code=text]for i = 1 to CHARS { for j = 1 to i { print "$" } print \newline } [/code] second problem: [code=text]for i = 1 to CHARS … | |
Re: Read it as characters and convert the character '0' to the number 0. [CODE] fgets(z, sizeof(z),stdin); tk = strtok(z," "); while( tk != NULL){ c[index] = atoi(tk); index++; tk = strtok (NULL, " "); }[/CODE] Keep the [ICODE]fgets()[/ICODE] statement. Throw out the rest. Loop through the buffer read and follow … | |
Re: It's because a [iCODE]for[/icode] is structured as [iCODE]for (initialize; condition; increment)[/icode] So if you have [iCODE]for ( int i = 0; int j = 5; ; i++ )[/iCODE] which is the initialize, condition, and increment. | |
Re: [CODE] if(!inQuiz)//if file did not open correctly { cerr <<"File could not be opened." <<endl; exit(1); } [/CODE] There is no reason to call a function to exit from [ICODE]main()[/ICODE]. Just [ICODE]return 0;[/ICODE] [CODE] inQuiz.seekg(0);//set position to begining of file[/CODE] When you open a file you are at the beginning … | |
Re: [QUOTE=blackrobe;1159189][QUOTE=Ancient Dragon;1159142]Post the code that shows how you constructed the contents of that path variable and argv[] array of strings.[/QUOTE] Alright, well the program I'm trying to exec doesn't really need any arguments..so you can think of the [I]arguments array[/I] as being: [B]char **arguments_array = {program_name, NULL};[/B] and the [I]path … | |
Re: [url=http://lmgtfy.com/?q=binary+search+trees]Try This[/url] | |
Re: Input the operation before the [ICODE]do[/ICODE]. Then just before the [ICODE]while[/ICODE] input the next operation. | |
Re: Do you have to deal with each value from 0 to 255 for each color? | |
Re: Then every time you [ICODE]delete[/ICODE], set [I]a[/I] to NULL as you did here. And every time you [ICODE]delete[/ICODE], if [I]a[/I] is NULL, don't. There is no [I]a[/I] to delete. | |
Re: That completely depends on why he called the function twice. Not enough information for a solid guess. | |
Re: [ICODE]1.) system("PAUSE"); 2.) system("PAUSE>NUL");[/ICODE] Neither are recommended... [ICODE]3.) cin.ignore(2); [/ICODE] Useless without [ICODE]cin.get()[/ICODE] to read the character to enter. Use a combination if [ICODE]cin.ignore[/ICODE] followed by [ICODE]getline[/ICODE] to pause your code. By the way, software does not [I]collapse[/I]. Please explain what you really see in detail otherwise all we are … | |
Re: Looks like your two hour time limit is going to approach fast. Maybe you should have figured out how to program rather than wasting your time writing this up for cheating. | |
Re: [QUOTE=evstevemd;1158806]Random number mean that it changes value. The position is the same. Did you wanted to change position or value?[/QUOTE] Not necessarily. It simply means you cannot predict the next value -- which in fact may be the same as the current value. | |
Re: [url=http://lmgtfy.com/?q=depth+first+search]Try This[/url] | |
Re: And we're supposed to magically figure out which of the 283 lines might be your problem? [QUOTE=atticusr5;1158723]I am trying to get my school program on pointer variable linked lists to work, but I have incountered a runtime error. [/quote] Bummer. Since there are quite a few [I]runtime errors[/I], is there … | |
Re: [QUOTE=DavidDD;1157893]Yes, I could do that. But it would be a lot easier only having 1 type to keep track of. Else I would have to check if it's 11 and create a new char/string and print that instead.[/QUOTE] Not true. Just create a name string array available for all displays: … | |
Re: Come on, people. The solution is much more basic than anything posted here. The solution is [B][url=http://www.gidnetwork.com/b-38.html]Learn to format your code![/url][/B] This link (if followed properly) will eliminate most [ICODE]else[/ICODE] problems, bracket/parenthesis problems, and misread code problems. It makes your code easier to read, understandable, and maintaining the code is … | |
Re: [QUOTE=shah1248;1148640]Please use gets() instead of scanf() if you expect spaces in the user input. scanf() does not handle spaces the way you want it to work.[/QUOTE] [QUOTE=Aia;1148733]gets() is not an option, because there's no way of controlling how much data can be inputed. There's no way of using it safely. … | |
Re: If you seriously want to report a misbehaving ad, post in the [B]DaniWeb Community Feedback[/B] forum. If you're just complaining, I'm with you, man! | |
Re: You apologize, but you don't bother to correct the situation. Like everyone else, I don't know what you need help with since you can't be bothered to explain it. | |
Re: Read each word. Search for 'w' in the word. Pretty simple. | |
Re: Read? Sound like from a file or user input. Or do you mean [I]get[/I] the time from the system? I really don't see the need to get both separately. Get them together and move the DATE into the date variable, move the TIME into the time variable. I'm actually not … | |
Re: Usually, I'd tell you [url=http://www.gidnetwork.com/b-57.html]fflush(stdin)[/url] is wrong. But since you are using a thirty year old compiler with functions that haven't existed since the mid-80's, I'll let it go this time. I hope you aren't learning on this compiler for a potential career. You will have to unlearn a great … | |
Re: [QUOTE=WhyteRyce;1158119]P.S. I dont want to use a cin.ignore() and cin.get() after one another as the double enter makes things sluggish and clunky feeling.[/QUOTE] Yes you do. [ICODE]cin.ignore[/ICODE] is not an [I]input[/I], it clears the buffer. Then to make it wait, you use the [ICODE]cin.get[/ICODE]. But, as [B]firstPerson[/B] mentioned, [ICODE]getline[/ICODE] would … | |
Re: Sure. Line 235 is wrong. Don't use a pointer there.... | |
Re: Nice details of the problem. I understand exactly what and where based on you extensive explanation. Answer: Maybe you coded it wrong. But I'm not searching through 262 lines of code for the one that might be wrong. Maybe you could help by giving us details? Line numbers? What actually … | |
Re: Good first post! Good title, Code with tags, mildly useful description. All in all, a great first effort. Unfortunately, you didn't post the entire error message. Also didn't mention what line the error is on. I don't see any lines that would have that error, either. Please add a few … | |
Re: Move each character after the '0' one location down the array. | |
Re: Start by writing some code that outputs each word. Then change the code to add capitalization. | |
The End.