5,676 Posted Topics

Member Avatar for isralruval
Member Avatar for WaltP
0
86
Member Avatar for hermann87

[QUOTE=hermann87;1116717]The problem here is that although I manage to rename the file name from "unsaved.txt" to whatever the user enters, the global char* variable ([B]fileName[/B]) won't change and remain "unsaved.txt" so the next time I try to write something new into this file it will still create a new "unsaved.txt". …

Member Avatar for mitrmkar
1
506
Member Avatar for Jpalka2010

If you are having trouble with step 2, you should not have any code for step 3 and beyond. Edit out all the stuff you cannot test without step 2 being finished. Then perfect step 2. Add step 3 and make sure it works. Then start adding step 4, a …

Member Avatar for jonsca
0
166
Member Avatar for markfisher

For example, your wrapper could keep track of all the memory allocated and deallocated. This would help you make sure you aren't attempting to deallocate twice, or not deallocating at all.

Member Avatar for WaltP
0
77
Member Avatar for Gaiety

[QUOTE=Gaiety;1115279]Yet Another Version of Findind a Prime number: [CODE] snipped [/CODE] i Hope this is the Efficient Version of All. Any other ways, Plz Welcome.[/QUOTE] I hope this is a joke. Please, do not take this code seriously... :icon_rolleyes:

Member Avatar for Gaiety
0
2K
Member Avatar for ryanshady

In [ICODE]AddNewElmnt()[/ICODE] you never checked the list to see if the character entered is already there. Check before adding.

Member Avatar for ryanshady
0
113
Member Avatar for deorcar
Member Avatar for smarty_t2
0
98
Member Avatar for abhimanipal

My questions are: Is this a bad cut & paste? If not: Who wants you to deal with this piece of trash code? When will you [I]ever[/I] do something like this (and keep your job)? Why do people insist on teaching this crap?

Member Avatar for xavier666
0
142
Member Avatar for hauda67

[QUOTE=hauda67;1116643]What am I doing wrong? [/QUOTE] Not reading [url=http://www.daniweb.com/techtalkforums/faq.php?faq=daniweb_policies]this[/url] and [url=http://www.daniweb.com/techtalkforums/thread78223.html]this[/url] as requested, and assuming we are psychic.

Member Avatar for Salem
-1
149
Member Avatar for abhimanipal

Because in the first case, the pointer [B]p[/B] is pointing nowhere. You defined the pointer, but never pointed it to space for the data. In the second, you allocated data space, and the address was placed into the pointer. But the only reason it didn't segfault is luck. The space …

Member Avatar for WaltP
0
281
Member Avatar for SeanBlack0000

[url=http://www.gidnetwork.com/b-38.html][B]FORMAT[/B]!!!![/url] How do you expect us to read that?!?! Use the [B]PREVIEW [/B]button and if you don't like what you see, neither will we -- fix it! If your pumps hold 100 gallons and you ask for more than 100 gallons, the pumps at that station can't handle the requests. …

Member Avatar for SeanBlack0000
0
111
Member Avatar for VilePlecenta

Allocate a large temporary chunk of memory when recording starts. If you need more space, allocate another temporary chunk -- not one at a time -- to save time. Keep track of your chunks. When you stop recording, Allocate one more chunk just large enough to hold the entire recording …

Member Avatar for VilePlecenta
0
330
Member Avatar for zangetsuu

[QUOTE=zangetsuu;1113830]my function was working all fine and dandy but boring until my friend separated the function for me which we are suppose(required by teacher) to do and now my program stops after i enter the first and last name ( i was the one that added multiple return 0;) i …

Member Avatar for zangetsuu
0
1K
Member Avatar for SeanBlack0000

This is [B]NOT[/B] a code snippet, this is a help request. Post properly. Look up what a [I]code snippet[/I] is if you are unsure.

Member Avatar for WaltP
0
473
Member Avatar for ELBUF

[QUOTE=ELBUF;1113949]That first return statement is shown indented a lot, but I have it fine in my code. It pasted strangely, [/QUOTE] Convert TABs to 4 SPACEs. TABs don't work well on forums.

Member Avatar for fadrior
0
658
Member Avatar for vidit_X

My initial reaction is it needs whitespace. 1) Indent 3-4 spaces, not 1 2) More spaces on a line [iCODE]for (int j = 0; j < dim2; j++)[/iCODE] [iCODE]c.mat[i][j] += this->mat[i][k] * x.mat[k][j];[/iCODE] 3) Blank lines between logical sections Makes the program more readable.

Member Avatar for vidit_X
0
266
Member Avatar for enderes05

[QUOTE=sdh;1114458]the prototype of main is already written in the header files.[/QUOTE]He said it was solved. [QUOTE=sdh;1114463]u hv not written void main()[/QUOTE] No he not wrtn tht. Dun writ leet spk, use ful engsh so ppl wth bd englsh cn unnerstnd. This is part of the [url=http://www.daniweb.com/techtalkforums/faq.php?faq=daniweb_policies]Forum Rules[/url].

Member Avatar for lsandling
-1
240
Member Avatar for D_switch

Recommendation--- Start over. Write the input function. Test it. Write the display function. Test it. you can copy the code from the current code to make it faster, but from now on *never* write the entire project without compiling and testing often. Write it in segments.

Member Avatar for WaltP
0
4K
Member Avatar for me_roy

[QUOTE=me_roy;1114720]Hi all, I am stuck here after several hours tried. Here the thing. I have txt file that contain float data (1 column and many row) such like this (4 float data): 0.799 0.851 0.926 1.000 Then i want to read it as array. My code is work until this …

Member Avatar for me_roy
0
316
Member Avatar for johndoe444

You mean like Batman and Robin? The Tick and Arthur? Thelma and Louise? Spiderman and Seabiscuit?

Member Avatar for johndoe444
-8
373
Member Avatar for atticusr5

[B]assign5.cpp:83: error: too many arguments to function âvoid Sort(cStudent (&)[30], int)â[/B] Well, the function [B]Sort[/B] has more parameters in the call than the function is designed to take. Hope that helps...

Member Avatar for atticusr5
0
119
Member Avatar for bun

[QUOTE=adnan.siddique;1112514]check this code[/quote] OK... [CODE]#include<stdio.h> # include <stdlib.h> int main() { int x = 0; printf("plz enter a number : ");[/code] Improper English. It's spelled "Please" [code] scanf("%d",&x); int y = 2 , z = 0; int * factors = (int*)malloc(100 * sizeof(int)); [/code] Declaring variables [I]after[/I] executable statements is …

Member Avatar for bun
-1
111
Member Avatar for XiaO yuEn

[QUOTE=XiaO yuEn;1112714]nput a number between 1-9, then choose 2 character, e.g: * and =. The sample output: Enter number: 5 Enter character: * = * == *** ==== ***** I had tried many times, but don't know where i was doing wrongly. Please help, thanks! [/QUOTE] We don't know what …

Member Avatar for rohitn
-1
108
Member Avatar for iammfa

[QUOTE=iammfa;1112751]Thanks Fbody for trying help me, I paste your corrected code but compiler gave me error:[/QUOTE] Proof positive -- if you [I]give[/I] an answer to someone, they will just copy and paste your solution into their code rather than try to [I]understand[/I] what you wrote and [I]fix[/I] their code. [B]iammfa[/B] …

Member Avatar for WaltP
0
228
Member Avatar for naveenreddy61

[QUOTE]i think i have the best one[/QUOTE] You violate [B]Salem[/B]'s 2nd rule and you think your solution is better? Think again. And your switch statement is terrible. And you used [iCODE]scanf("%s",str);[/iCODE], too. Very dangerous...

Member Avatar for WaltP
0
973
Member Avatar for yUhki
Member Avatar for Nexadus
Re: Lab

Isn't a vector automatically sorted? Or am I thinking of something else?

Member Avatar for Nexadus
0
113
Member Avatar for cmsc

Depends on what you're trying to do. With all the '[B]#[/B]' signs and no formatting, the code is too hard to follow without some explanation. Plus you should always [I]explain[/I] what you're doing and not force us to read, understand, digest, and debug your code. Remember, [I]we[/I] didn't write it …

Member Avatar for Nick Evan
-1
96
Member Avatar for sutty8303

[QUOTE=hag++;1112121]That will work but a function should really stick to only doin one thing... either calculation or cout, since this is not a complex task. [CODE] float circle_area(float radius) { return PI * radius * radius; } [/CODE] Then do the cout's in main[/QUOTE] This thread needs no more help. …

Member Avatar for peter_budo
0
306
Member Avatar for cwarn23

[I]Leap[/I] was great too. Too bad they edited out the copyrighted music for the DVDs. Same with [I]Greatest American Hero[/I].

Member Avatar for WaltP
0
106
Member Avatar for ShawnCplus

IMAO spoonfeeding should be an offense. But the Rules as written allow it. This has been discussed before and while spoonfeeding was not encouraged, what could we really do about it? Infracting is too harsh but that's the only 'punishment' we have.

Member Avatar for almostbob
0
403
Member Avatar for atticusr5

In [ICODE]cCourselist::Load()[/ICODE], why are you passing in [ICODE]Infile[/ICODE]? If you aren't using it anywhere else, just define it locally where you need it. Same with [ICODE]Outfile[/ICODE].

Member Avatar for atticusr5
0
112
Member Avatar for Iam3R

You forgot the [ICODE]#endif[/ICODE] The correct way of doing what? What are you trying to do?

Member Avatar for Dave Sinkula
0
103
Member Avatar for cwarn23

Look again at what firstPerson gave you and try to understand what he wrote. It answers your question -- unless you didn't ask the right question...

Member Avatar for Poincarre
0
416
Member Avatar for abhi.it01

Not a clue what you want. Think through your question carefully and give us enough information to understand the problem you're having.

Member Avatar for WaltP
0
224
Member Avatar for Duki
Re: Qt

How many questions have been asked/answered about QT so far?

Member Avatar for WaltP
0
25
Member Avatar for schoolboy2010

[QUOTE=jonsca;1111231]You have to pick one of your threads, don't just keep adding to both. [/QUOTE] [QUOTE=schoolboy2010;1111234]sorry.... was a mistake... reply here... or there... anywhere is fine.....[/QUOTE] No it isn't. "[I]Anywhere is fine[/I]" doesn't solve the problem. Other thread closed. Problem now solved.

Member Avatar for WaltP
0
157
Member Avatar for agurrea

No, what the problem is your understanding of numbers. 10.1 is identical to 10.10 is identical to 10.1000000 Each is 10 and [B]1[/B] tenth. It doesn't matter how many zeros you add. Therefore, 10.5 (10 and [B]5[/B] tenths) > 10.10000000

Member Avatar for agurrea
-1
194
Member Avatar for smbee

[QUOTE=smbee;1106621]I am new to C programs. I have tried to write the code for game of life. I started with just the first part. But its still not done. There are some errors. could you please point out where I am wrong?[/QUOTE] Here are the first places where you are …

Member Avatar for smbee
-1
308
Member Avatar for markfisher

When they pass in the list address to delete, if it hasn't been initialized, don't delete it. Return an error code.

Member Avatar for markfisher
0
161
Member Avatar for WaltP

I have a page with a navigation column and a data column that I wish to control separately, both sides use forms. When I scroll down and click on a button on navigation side I want the data side to change accordingly but I want the nav side to stay …

Member Avatar for diafol
0
100
Member Avatar for makan007

[QUOTE=makan007;1109694]"I am trying to display an array of digits using rand. My final result need to be: 1) Output all digits <=40 to the left side of array 2) Output digits > 40 to the right side of array[/QUOTE] I was unaware arrays had sides. What do you mean? [QUOTE=makan007;1109694]Prob: …

Member Avatar for kvprajapati
0
102
Member Avatar for rkulp

[QUOTE=firstPerson;1109766]Although I think it could be called before main.[/QUOTE] Impossible. [I]Nothing[/I] can be called before [ICODE]main()[/ICODE]

Member Avatar for hag++
0
247
Member Avatar for trevorthecat

[QUOTE=trevorthecat;1110170]Thanks. I switched the order of the cout statement and sort call, and now I get 10 -numbers and 10 random numbers sorted. Not sure why the first ten are messed up though?! Thoughts? [/QUOTE] My thought is "[I]why the first ten are messed up[/I]" explains nothing? No one but …

Member Avatar for WaltP
0
130
Member Avatar for Zach101man

With what? You gave us nothing to help with. Did you forget to read the Rules and the sticky posts at the beginning of the forum?

Member Avatar for WaltP
0
54
Member Avatar for Adami

You do not want your variable to be [ICODE]static[/ICODE]. Set [ICODE]lowest_int[/ICODE] to the first value in the parameter list, then check all the others.

Member Avatar for Adami
0
121
Member Avatar for Draculaboy1014

Your program tried to access outside the bounds of your variables -- for example trying to access [ICODE]var[20][/ICODE] when the definition is [ICODE]int var[10];[/ICODE]

Member Avatar for gerard4143
-2
140
Member Avatar for Soileau

Oh No!!! Not the String/scanf() faux pax!!!! [CODE] scanf("%s",name); scanf("%s",state); scanf("%s",rating); [/CODE] Please [url=http://www.gidnetwork.com/b-62.html]read this[/url]

Member Avatar for WaltP
0
182
Member Avatar for speakvair

Rewrite your look so you don't call [iCODE]main()[/iCODE] to start the loop again.

Member Avatar for thomas_naveen
0
162
Member Avatar for dlannetts

And why are you claiming [I]console apps[/I] are not [I]programs[/I]? How do [url=http://www.google.com/search?hl=en&client=firefox-a&rls=org.mozilla:en-US:official&hs=13n&defl=en&q=define:computer+program&ei=Uf1YS5qMKJHSMpG42IMP&sa=X&oi=glossary_definition&ct=title&ved=0CAcQkAE]these definitions[/url] not fit a console app? :icon_wink:

Member Avatar for dlannetts
0
240

The End.