5,676 Posted Topics

Member Avatar for onlymsfrance

If [icode]menu()[/icode] returns a value, then return the value. It should be a [ICODE]char[/ICODE], not [ICODE]void[/ICODE], function.

Member Avatar for WaltP
0
80
Member Avatar for phoenixlsk

Try reading some of the sticky posts that are labels [B]Read Me:[/B] to learn good posting techniques...

Member Avatar for manojthesingham
0
376
Member Avatar for jam123

[QUOTE=Alibeg;818401]@csurfer i thought that you cannot read a string like [icode]scanf ("%s", stu_name[j]);[/icode] if you defined [icode]stu_name[/icode] like [icode]char stu_name[MAX_LENGTH];[/icode][/QUOTE] Yes you can, but you shouldn't. If your string has a SPACE in it, you only read up to that space. And reading a string with [ICODE]scanf()[/ICODE] is identical to …

Member Avatar for Alibeg
0
145
Member Avatar for tux4life

[QUOTE=siddhant3s;818559] BTW,[icode] char chr_digits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '\0'};[/icode] is same as [icode] char chr_digits[] ="0123456789";[/icode][/QUOTE] True. But based on the code you don't seem to need a [I]string[/I], just an array of characters. So [icode]char chr_digits[] = {'0', '1', '2', '3', '4', …

Member Avatar for tux4life
0
137
Member Avatar for 1o0oBhP

[QUOTE=cscgal;98982]Hey there, 1o0oBhP ....... err, that was quite a mouthful (err, keyboardful) spelling out your name :) [/quote] That's why I cut'n'paste :icon_smile: [QUOTE=cscgal;98982]In any case, we like to make it a general policy not to create new forums until we see a need. The phrase "build it and they …

Member Avatar for regatoni
0
248
Member Avatar for emj83

I'm not sure how adding if statements for edge checking makes the code simpler. In my experience, additional code always complicates, rarely simplifies, readability.

Member Avatar for death_oclock
0
96
Member Avatar for Fouly

[QUOTE=Fouly;811863]Hi, I'm trying to pass parameters to an exe file using C++...i tried the following code: [code] system("FileName.exe"); [/code] but this command line just fire the .exe file without passing any arguments... Thanks, Mostafa Fouly[/QUOTE] In order to pass arguments you have to pass arguments. All you did was execute …

Member Avatar for siddhant3s
0
682
Member Avatar for Rashakil Fol

IMAO, giving bad rep then giving good rep to nullify it is asinine. If you think they deserve bad rep, give it. If you're concerned about their rep points going in the toilet, don't give it. The only thing I've seen in this thread that makes even a little sense …

Member Avatar for happygeek
0
169
Member Avatar for yang120

[QUOTE=yang120;811918]why and?? because is like the user only need to put a or b not a and b[/QUOTE] Because with OR the comparison is [I]always[/I] true. The only way the IF can be false is if [icode]input[position][/icode] is equal to [I]all[/I] of the letters, an impossibility. The other reason is …

Member Avatar for yang120
0
154
Member Avatar for nparrish15

First, please learn to [url=http://www.gidnetwork.com/b-38.html]Format your code[/url] so we can read it easier. You need to store each factor in an array as you generate them. Using your 100, you first generate 2. Save it in the array and you have 50 left. Run the loop again on the 50 …

Member Avatar for arghasen
0
129
Member Avatar for Himerz

The idea behind c-strings is that they end with a '\0' character. You have defined the array to be 11 characters then ask for 11 characters. There is no room for the \0. You must only read 10 characters. And on a style note, if you ask for the string …

Member Avatar for zalezog
0
140
Member Avatar for SHWOO

You're reading into an integer and each line contains an integer. Even though you didn't explain what you actually want I assume you mean to read each individual [I]digit[/I] into the [B]j_mapKey[/B] array. If so, read each digit as a [I]char[/I] and convert to an integer by subtracting 48.

Member Avatar for WaltP
0
78
Member Avatar for Linking_90

Now read the information 1) in [url=http://www.daniweb.com/techtalkforums/faq.php?faq=daniweb_policies]the Rules[/url] you were asked to read when you registered 2) in the text at the top of this forum 3) in the announcement at the top of this forum titled [url=http://www.daniweb.com/techtalkforums/announcement8-3.html]Please use BB Code and Inlinecode tags[/url] 4) in the sticky post above …

Member Avatar for Linking_90
0
145
Member Avatar for M3rcury

You really need to tell us the [I]real[/I] problem, which is "I cannot get the program to compile. The error message I get is..." You cannot define a function within another function as you are doing. [B]round()[/B] cannot be within [B]main()[/B].

Member Avatar for Ancient Dragon
1
110
Member Avatar for riahc3

Making a change to [B]RF[/B]'s equation will give you the ability to get random numbers in [I]any[/I] range. Add a [icode]start[/icode] and a [icode]range[/icode] variable: [icode]((int) (range * (rand() / (1.0 + RAND_MAX))) + start) [/icode] So, if you want numbers from (and including) 3 through 10, [icode]start[/icode] is 3, …

Member Avatar for Rashakil Fol
0
132
Member Avatar for iamstrange14

There is no built in way. Easier? Can't think of anything easier than checking characters.

Member Avatar for carobee
0
80
Member Avatar for drjay1627

Since you never initialized [ICODE]command_array[/ICODE], it starts out with junk in it. Then you added your input to that junk. Is the first parameter to [ICODE]execvp[/ICODE] supposed to be a single character? That's what you are passing. After making changes you should repost the code so we can see it's …

Member Avatar for drjay1627
0
148
Member Avatar for ryan858

The problem with [B]AD[/B]'s solution is you never really know when you're at the beginning of a line. You can: Read a complete line. Test the beginning for the word in question. If found, there are many ways to 'parse' the line. 1) looking at each character and dealing with …

Member Avatar for ryan858
0
96
Member Avatar for RexxX

[QUOTE=RexxX;800926]Well, I want to know how to insert a full string into the array of strings. I thought it might be: [code]fscanf(infile, "%s", *arr[i]);[/code] but this line gave me the error "warning: format argument is not a pointer (arg 3)".[/QUOTE] No. It would be [icode]fscanf(infile, "%s", arr[i]);[/icode] But, [url=http://www.gidnetwork.com/b-62.html]see this …

Member Avatar for RexxX
0
159
Member Avatar for claretm

Start by writing a program to determine the prime numbers less than 1,000,000. Then modify the program to test the differences.

Member Avatar for claretm
0
3K
Member Avatar for flip.phinoi

[QUOTE=flip.phinoi;800473]Sorry about that... noobie :)[/quote] Not an excuse. There are at least 6 places where CODE tags are suggested/described. The first is in the rules you were asked to read when you signed up. The last is right on the background of the input box you typed your message into. …

Member Avatar for WaltP
0
287
Member Avatar for Happie Juice
Member Avatar for Nick Evan
0
100
Member Avatar for NexusX

Actually, you can't assign a char to a string, but you can [I]add[/I] a char to a string. A minor change to you program above: [code=cpp] int main() { string user_input; string first = ""; getline(cin,user_input); first += user_input[0]; cout << "Frist character is " << first << endl; return …

Member Avatar for WaltP
0
2K
Member Avatar for Kraizy

[QUOTE=niek_e;796511]There are a few thing wrong with your code : - you're incrementing 'i' twice in your word_count function. That's not good. You're missing characters because of this and you'll probably run out of array-bounds.[/quote] Not really. There loop [B]only[/B] increments [ICODE]i[/ICODE]. That's the only real problem. [QUOTE=niek_e;796511]- Why use …

Member Avatar for axyelp
0
180
Member Avatar for Rein Valdez
Member Avatar for pcongnu

To expand on what [B]vmanes[/B] said, create a 2D array, something like [ICODE]inputbuffer[4][250][/ICODE] (4 lines, 250 chars each). Reading each character, load the characters in the array. When you reach the end of one line from the file, add a \0 character and point to the beginning of the next …

Member Avatar for galin
0
92
Member Avatar for Zockaddiprork

[QUOTE=peter_budo;793334]Yes, it is cool side, but I see no reason to spam around the forum without reason...[/QUOTE] One post IMO is not "spam[ming] around the forum"

Member Avatar for The Dude
0
57
Member Avatar for >shadow<
Member Avatar for ItecKid

getline will read the entire line, then you'll have to break up the line read into its individual strings. Alternatively, you can use >> to read in each individual string. >> will stop reading at whitespace.

Member Avatar for ItecKid
0
151
Member Avatar for Ratte

Can't be done. Change your message to [B]Press ENTER to continue[/B] and just use the standard I/O functions.

Member Avatar for Comatose
0
1K
Member Avatar for masterarcher

My guess would be that this loop [code=c] for(loopcounter=9; loopcounter!=NewRank; loopcounter--) { [/code] exits when [I]loopcounter[/I] equals [I]NewRank[/I] so [code=c] if(loopcounter==NewRank) { ListToBeChecked[loopcounter].TimeTaken = Time; strcpy(ListToBeChecked[loopcounter].Username,UsersName); } [/code] is never executed. Also, [url=http://www.gidnetwork.com/b-57.html]see this[/url] about [ICODE]fflush(stdin);[/ICODE] [url=http://www.gidnetwork.com/b-56.html]and this[/url] about [ICODE]gets(UsersName);[/ICODE]

Member Avatar for ianvdl
0
108
Member Avatar for orthographer

* You also didn't bother to read the rules as requested multiple times during registration (code tags and the title show that) * you didn't format you code so people can read it * you somehow think people are here just to bail you out of your problem and don't …

Member Avatar for WaltP
0
208
Member Avatar for anu123d

The problems I see in that function: 1) using [ICODE]getch()[/ICODE] -- [url=http://www.gidnetwork.com/b-43.html]see this[/url]. 2) recursively calling fnAddDepartment(); because an invalid department entered. Should simply loop back to reenter the value. 3) Your formatting does not make it easy to read the function. [url=http://www.gidnetwork.com/b-38.html]See this about formatting[/url].

Member Avatar for Murtan
0
222
Member Avatar for me_ansh

Who says the 'buffer on the stack' is formatted properly for [icode]sscanf()[/icode]?

Member Avatar for me_ansh
0
94
Member Avatar for Rein Valdez

You were asked to use code tags which are described 1) in [url=http://www.daniweb.com/techtalkforums/faq.php?faq=daniweb_policies]the Rules[/url] you were asked to read when you registered 2) in the text at the top of this forum 3) in the announcement at the top of this forum titled [url=http://www.daniweb.com/techtalkforums/announcement8-3.html]Please use BB Code and Inlinecode tags[/url] …

Member Avatar for Rein Valdez
0
117
Member Avatar for akim_atl

The only correction I can see, and it's minor, is that [I]postconditions[/I] is not a valid English word.

Member Avatar for WaltP
0
269
Member Avatar for Passiongamer25

You said the temperature in the file is in the format C23.4 F74.7 Where did you read the C or F? Where did you test the C of F to decide if you need to convert?

Member Avatar for Passiongamer25
0
94
Member Avatar for mohan_198505

[QUOTE=csurfer;787859][QUOTE=Aia;787248][ICODE]scanf("%[^\n]",str);[/ICODE] Do you want to bet I can overflow the 15 characters that str[] can hold?[/QUOTE] Wat u said regarding the overflow of string array is perfectly right...but my question is can such overflow of array's at such subtle level cause major damages.? if yes how.? and what to refer …

Member Avatar for Aia
0
116
Member Avatar for neoseeker191

Your shuffle seems backwards to me. Assuming [I]card[/I] values mean something like 1 = 2 of clubs 2 = 3 of clubs ... 13 = A of clubs 14 = 2 of Diamonds ... 52 = A of Spades I'd change the shuffle to something like this... Fill an array …

Member Avatar for neoseeker191
0
1K
Member Avatar for encee

That's how sscanf works. A decimal is illegal for integers so the translation ends. You'll have to reconsider how you read/translate the file. Also, consider these problems: [url=http://www.gidnetwork.com/b-66.html]see this[/url] about [icode]void main()[/icode] You've defined [icode]c[][/icode] to be 10 characters. How many characters are in the first line for [i]textfile.txt[/i]? And …

Member Avatar for me_ansh
0
1K
Member Avatar for rhoit

Usually you change the buffer in memory, then write the whole buffer to the file after all the changes are made. Don't try changing the file as you change the display.

Member Avatar for Murtan
0
137
Member Avatar for Jacky1

Now I'm completely confused. In your first post you state [quote]am trying to append to file but its not going correctly[/quote] The problem is you open the file for append (write at end) then try [I]reading[/I] from the file. That's just backwards. Then: [QUOTE=Jacky1;786265]but what if I want read from …

Member Avatar for WaltP
0
125
Member Avatar for meabed

[QUOTE=thekashyap;318192]3. Optimizing the breaking conditions in for loops. If you know that the loop variable's range is from 0 to some +ve number AND it doesn't matter which way you traverse while looping, you can optimize the loop like this: [code=c++] //original loop for( int i = 0; i <= …

Member Avatar for Lisa1110
3
1K
Member Avatar for Dani

So far, I like the look although I haven't explored fully. The first thing I noticed that I'd like corrected is putting the "Community" tab back on each page rather than accessed only at the bottom of the main forum page.

Member Avatar for William Hemsworth
0
866
Member Avatar for RenFromPenn

Come come people. Look at the code. You can't read an [B]integer[/B] using [B]%c[/B]

Member Avatar for Alibeg
0
134
Member Avatar for learning_prog

Reread Ancient Dragon's post. He did say change the #include statement, but that wasn't all he said...

Member Avatar for John A
0
129
Member Avatar for monere

You need to search out the binary AVI file format and read the file header. The length should be in the header.

Member Avatar for skatamatic
0
103
Member Avatar for philzz
Member Avatar for skatamatic
0
197
Member Avatar for rajuprasad82

YEs, there are quitre a few people here that can help. What have you got so far?

Member Avatar for Comatose
0
130
Member Avatar for jbennet

Don't you know the universal icons for... for... heck, I don't know either!!!

Member Avatar for WaltP
0
157

The End.