5,676 Posted Topics

Member Avatar for luvmusic202006
Member Avatar for mzn

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

Member Avatar for WaltP
-1
85
Member Avatar for qk00002

VB6 is probably no longer available, but VB-Express 2008 can be downloaded from [url=http://www.microsoft.com/express/Windows/]here[/url]

Member Avatar for WaltP
1
342
Member Avatar for ammarZ

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?

Member Avatar for jephthah
0
115
Member Avatar for rgpii

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

Member Avatar for WaltP
0
1K
Member Avatar for lethal.b

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.

Member Avatar for WaltP
0
250
Member Avatar for top123

And I'm the second one to agree with [B]FBody[/B]. Do you still think he's wrong?

Member Avatar for top123
0
120
Member Avatar for newbiecoder

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

Member Avatar for newbiecoder
0
257
Member Avatar for Masterace
Member Avatar for Masterace
0
2K
Member Avatar for tquiva

After you test for EOF, test for an invalid character. If you got one, clear the rest of the input buffer and return 0.

Member Avatar for WaltP
0
333
Member Avatar for tquiva

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.

Member Avatar for WaltP
0
297
Member Avatar for xxxSuperTrooper

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.

Member Avatar for WaltP
0
745
Member Avatar for ubi_ct83
Member Avatar for Jeff_5_7
Member Avatar for Kombat

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

Member Avatar for WaltP
0
81
Member Avatar for Ancient Dragon

[QUOTE=apegram;1153659]What if the Queen is overthrone beforehand? Hmmm?[/QUOTE] Is she a drinker? Maybe she'll be underthrone.

Member Avatar for diafol
0
242
Member Avatar for vuki27

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

Member Avatar for Narue
0
5K
Member Avatar for sho12345

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 …

Member Avatar for Galf
0
172
Member Avatar for Aby_G

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

Member Avatar for sganesh
0
166
Member Avatar for Kombat

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 …

Member Avatar for WaltP
0
79
Member Avatar for Salem

I just decided to call the post as it was... I guess it caught on.

Member Avatar for ~s.o.s~
2
339
Member Avatar for lgonzo

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.

Member Avatar for WaltP
0
2K
Member Avatar for James.Butcher

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

Member Avatar for Ancient Dragon
0
324
Member Avatar for blackrobe

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

Member Avatar for Ancient Dragon
0
4K
Member Avatar for riahc3
Member Avatar for Narue
0
52
Member Avatar for PSP1202

Input the operation before the [ICODE]do[/ICODE]. Then just before the [ICODE]while[/ICODE] input the next operation.

Member Avatar for WaltP
0
102
Member Avatar for josolanes
Member Avatar for nizbit

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.

Member Avatar for tetron
0
311
Member Avatar for johndoe444

That completely depends on why he called the function twice. Not enough information for a solid guess.

Member Avatar for rdxblast
0
132
Member Avatar for !nsane

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

Member Avatar for !nsane
-1
127
Member Avatar for vivekvxz

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.

Member Avatar for Nick Evan
0
574
Member Avatar for empror9

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

Member Avatar for Stefano Mtangoo
0
128
Member Avatar for pikesh
Member Avatar for XTRobot
Member Avatar for atticusr5

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 …

Member Avatar for tetron
0
89
Member Avatar for DavidDD

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

Member Avatar for WaltP
0
114
Member Avatar for aianne

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 …

Member Avatar for WaltP
0
972
Member Avatar for DoEds

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

Member Avatar for DoEds
1
278
Member Avatar for clutchkiller

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!

Member Avatar for cwarn23
1
130
Member Avatar for empror9

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.

Member Avatar for Excizted
0
143
Member Avatar for gunjan_29
Member Avatar for Mz3g

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 …

Member Avatar for Mz3g
0
105
Member Avatar for ah.MirZan

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 …

Member Avatar for WaltP
0
241
Member Avatar for WhyteRyce

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

Member Avatar for WhyteRyce
0
301
Member Avatar for blackrobe
Member Avatar for ganesanronaldo

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 …

Member Avatar for ganesanronaldo
0
139
Member Avatar for twalls16

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 …

Member Avatar for twalls16
0
347
Member Avatar for lethal.b
Member Avatar for jonsca
0
112
Member Avatar for manjaro

Start by writing some code that outputs each word. Then change the code to add capitalization.

Member Avatar for arafat_alam
0
112
Member Avatar for silvert122
Member Avatar for tetron
0
132

The End.