5,676 Posted Topics
Re: C'mon guys, the answer is simple. [QUOTE=Karthy;936111]why C is a not a object oriented program ?[/QUOTE] Because it was designed as a procedural language. Simple as that. | |
Re: [QUOTE=Brandon515;936594]help please ok here is my code [ICODE]void sleep() { energy 100; happy + 20; strength - 1; bladder 70; age + (hour * 8); };[/ICODE] ok? all the varibles are preprocesser defined, you know #define energy 100.[/QUOTE] If this is true, what does the statement [ICODE]100 100;[/ICODE] do? (first … | |
Re: Since it's a text box, just look at every character in the box and remember the index of each 2 you come across. | |
Re: 1) Accept input from the user 2) Open the file 3) Read a line 4) Use [ICODE]strcmp()[/ICODE] to see if the measurement is at the beginning of the line 5a) If not, back to 3 5b) If so, close the file and continue. Also, check out these links: [url=http://www.gidnetwork.com/b-38.html]Formatting C … | |
Re: Nothing wrong. A [ICODE]char[/ICODE] type can hold values from -128 to 127 only, a total of 256 values. So, 321 is too large and the extra basically falls out the end. 321 - 256 = 65 128 - 256 = -128 An [ICODE]unsigned char[/ICODE] can hold values from 0 to … | |
Re: What statement causes the error? Do you really expect us to search through 200 lines of code we didn't write to find an error that is unknown? Please give us enough details to help you. | |
Re: Has the book been released in ebook form? Did you search for it? | |
Re: You have a [B];[/B] you don't want at the end of the [ICODE]while[/ICODE] statement: [CODE] while ((c = getchar())!=EOF); if(islower(c)){ ++letter[c-'a'];} [/CODE] | |
Re: [QUOTE=red_dogexpress;929869]can anyone help please [/QUOTE] Sure. I added the CODE TAGS you ignored, 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 … | |
Re: Code tags explained: 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 titled … | |
Re: If usually starts with headers, then [icode]int main()[/icode]. Then there's an input of some kind. Then you get some [icode]if[/icode] statements with some math intermixed, maybe even a loop or three, and finally some output statements. | |
Re: [QUOTE=niek_e;920621]So with the sudden disappearance of Narue, the moderators are free to do anything the want right? I mean: no control what-so-ever until there's another s-mod? [/QUOTE] Just try it, I dare you! :icon_twisted: | |
Re: [QUOTE=scru;920312]... but doing something for the sake of the standard where it saves me a bit of effort to do it in another way that works just as well is retarded. [/quote] Makes sense. Let's use this attitude elsewhere in life. Gee, stopping for that red light ahead is just … | |
Re: :icon_idea: Maybe we can all learn from the Ancient one... :icon_wink: | |
Re: I called shenanigans and they delivered some Cock-A-Leeky soup and some nice roast mutton. | |
Re: There is no standard way to read characters like getch() | |
Re: Since we know the program you posted cannot possibly compile, and you claim it's actually running, you need to repost the current code you're compiling. And then explain [I]in detail[/I] what the program if doing wrong. Don't make us search for it. | |
Re: Another option is: [icode] cout << "." << flush(); [/icode] | |
Re: Add a do-while loop around the main portions of the code. At the end of the loop simply ask a question. Input the answer and the [icode]while[/icode] conditional can exit the loop or not. [B]But[/B], you should [url=http://www.gidnetwork.com/b-59.html]read this series[/url] about scanf() first. And you might as well read [url=http://www.gidnetwork.com/b-43.html]this[/url], … | |
Re: [icode]kbhit()[/icode] is useful, but using [icode]getch()[/icode] is also required. Understand what [I]both[/I] functions do, and you should be able to figure out how to use them for your program. | |
Re: [QUOTE=mshafi;913677]I tried to compile a code written in C which had included the file "graphics.h".It worked fine in my desktop PC which had a VGA monitor.But when i tried to run the same code in my laptop,it showed some graphics error. why is it like this?fG[/QUOTE] [i]Some graphics error[/i] is … | |
Re: [QUOTE=happygeek;908437]Obviously, maths is not an essential requirement :)[/QUOTE] I agree with that 1000%!!!! :icon_razz: | |
Re: [QUOTE=dcm882003;913106]I understand what you mean by the redundancy but that's what was stated the file reading has StudId, Quiz, Quiz, Quiz, Quiz, Quiz, am reading in 15 rows but the max will be 40. Which is what I need the counter.[/QUOTE] Then you should use a [ICODE]while[/ICODE] loop instead of … | |
Re: [quote]Also, note how the two biggest portion of our debt is due to Liberal politics: Medicare and Social Security. Wow, what an intelligent idea! [quote]Not even close to the truth - where the hell do you get your data. I want links; come on - support your statements![/quote][/quote] [code]1945 [B]Harry … | |
Re: [QUOTE=adatapost;906011] How to freed allocated memory? [CODE=C++] delete []p; [/CODE][/QUOTE] Don't you also have to delete each [ICODE]p[/ICODE] array? :icon_wink: If you aren't sure, the answer is [I]yes[/I], delete each array first before deleting [ICODE]p[/ICODE] itself. | |
Re: Enough, people. The facts are 1) fixed code should not have been posted by [I]anyone[/I] other than the OP 2) fixed code should not have been improved by anyone unless the OP posted correct code in the first place. 3) People who expect the world to [I]give[/I] them a free … | |
Re: [QUOTE=StaticShell;903113] I never posted a problem in my life so I prob encased this code wrong too.[/quote] you did [I]much[/I] better than 95% of the new posters that can't be bothered to understand the forum before posting. :) [QUOTE=StaticShell;903113] 1) How can I make a new line within my "output" … | |
Re: You're welcome. Read the rules. Including the use of [B]u[/B] for [i]you[/i], [B]no[/B] for [I]know[/I], etc. | |
Re: Your 1st half of the array [ICODE]array[x][0][/ICODE] is never initialized to zero so the values start out with garbage. | |
Re: [QUOTE=SP IT;902560]Here's what I have so far.[/QUOTE] And are you still having problems? Are we supposed to use our psychic powers or would you like to [I]explain fully[/I] what the problems are now? | |
Re: [QUOTE=bahr_alhalak;899373]the problem that i need to use this program in another way for example : for looping , do-while looping[/QUOTE] So what's the problem? Doesn't your book describe a [ICODE]for[/ICODE] loop and a [ICODE]do-while[/ICODE] loop? You need to try it, we aren't supposed to do it for you. | |
Re: [ICODE]atoi()[/ICODE] is portable [ICODE]itoa()[/ICODE] is not | |
Re: [QUOTE=cscgal;900271]Thanks for letting us know. I'm marking this thread solved since the offending user has been taken care of. :)[/QUOTE] [QUOTE=jbennet;900300]Cant banned users still send PMs?[/QUOTE] From the sounds of it, she had the user [I]taken care of![/I] Ouch! :ooh: :icon_mrgreen: | |
Re: You probably blew past your buffer and started writing to memory you should not have written to. | |
Re: [QUOTE=twomers;898519][inlinecode]unsigned int val = (unsigned int)array[0]; // For the value 1[/inlinecode][/QUOTE] If the OP wants the value 49, this will work. I think the OP might want the value 1 so subtract 48 from [ICODE]val[/ICODE] afterwards. But then again, he might mean something completely different. Please clarify [I]exactly[/I] what you … | |
Re: Binary files have binary information, not text information. Therefore, string functions probably will not be effective on the buffer. There are probably NULL characters in the binary data which will stop any string function from continuing past the character. | |
Re: [QUOTE=Rashakil Fol;191160]You don't need finer resolution timing. If you want to measure the thickness of a piece of paper, would you buy an expensive microscope, or would you measure a stack of 200 pieces of paper and then divide by 200?[/QUOTE] In other words, run it a whole bunch of … | |
Re: [QUOTE=lotrsimp12345;898195]nvm. going to ask teacher.[/QUOTE] Smart decision. At least your teacher knows what the program is supposed to do and can ask the questions needed to help you. | |
Re: [QUOTE=dsladev;898309]Here you go. Also as a side note, system ("pause") is a bad habit.[/QUOTE] So is: 1) posting code the OP should be writing 2) posting code that is not formatted Please do not post answers to questions. This forum is [I][B]not[/B][/I] a homework service. And that service should include … | |
Re: It looks like the parameter needs a [ICODE]char*[/ICODE] not a [ICODE]char[/ICODE]. IOW you need to pass the string, not the character. | |
Re: Why use Active-X? Just define a form, it's straight forward and simple. | |
Re: [QUOTE=MidiMagic;793547]The Firefox help site says it is probably an add-on some website installed without my permission.[/QUOTE] If this is true, what can [B]DaniWeb[/B] do about it? | |
Re: USE CODE TAGS!!! We see you didn't bother to read any of the requested information posted all over this site about CODE tags, like 1) in the Rules you were asked to read when you registered 2) in the text at the top of this forum 3) in the announcement … | |
Re: [QUOTE=jephthah;893095]why do you need a helper function? seems that all the work is being done there anyhow.[/QUOTE] Because it's part of the assignment. The helper function is undoubtedly supposed to be recursive, checking a character at a time. | |
Re: See [url=http://www.gidnetwork.com/b-38.html]this for formatting help[/url] | |
Re: Change your comparison to [ICODE]if (word[i] < 57 && word[i] > 49)[/ICODE] Also, the line is better written as [ICODE]if (word[i] > 49 && word[i] < 57)[/ICODE] It's a more logical order for the comparison pair. | |
Re: [QUOTE=blackrobe;893029]Hey there, I have a simple question: How can I read three characters by three characters from a string (character array) in C? Thanks for your help.[/QUOTE] You can't. A string is a single dimensional array and you need an array of arrays to read 3 by 3. | |
Re: [QUOTE=sijithjp;892784]plz help or give some advice... i tried a lot to do[/QUOTE] Not that we can see. Did you read the post titled "[I][B]Read Me: [/B]Read This Before Posting[/I]" | |
Re: [QUOTE=athlon32;892903]thanks, that fixed the problem, the only thing i don't get is that i copied that from cprogramming.com and it didn't work, someone really should let them know lol anyways, THANKS![/QUOTE] well, [I]you[/I] copied the program and found the error. Maybe that someone sould be [B]athlon32[/B]. :icon_wink: | |
Re: Even though you haven't told us all of your situation, I surmise the problem is when you come to a function from a library that you did not write. When you get to that function, Just execute it (don't step into it). |
The End.