1,088 Posted Topics
Re: Either you need to get more RAM for your head, or you are ignoring on purpose what you have been told before. Why don't you post that in C++ since that's what you keep compiling your program with? | |
Re: [QUOTE=GrimJack;695846]Would you consider [URL="http://www.youtube.com/watch?v=ZOgptvjwng8"]this[/URL] a 'lowrider' pc mod?[/QUOTE] Definitely a cool mod. Didn't know mineral oil was not conductive. I wonder how bad would the smell be. | |
Re: [URL="http://www.cs.utsa.edu/~wagner/CS2213/stack/stack.html"]Example[/URL] | |
Re: [QUOTE]“We the People of the United States, in Order to form a more perfect Union, establish Justice, insure domestic Tranquility, provide for the common defence, promote the general Welfare, and secure the Blessings of Liberty to ourselves and our Posterity, do ordain and establish this Constitution for the United States … | |
Re: Well, it appears this is as far as it will go. It is being [URL="http://valleywag.com/5051455/microsoft-to-announce-jerry-seinfeld-ads-cancelled-tomorrow"]canceled.[/URL] | |
Re: >How the hell did i do this! funny as hell That's nothing! I'll tell you what would be funny as hell. A new commercial with Bill Gates and Jerry Seinfeld, playing on violin [B][I]"Fiddler On The Roof"[/I][/B], as they hand stand, naked, against the wall. Makes you wonder what they … | |
Re: >please help with this program i dont know whats wrong. This is what's wrong with it. [CODE]#include "strlib.h" #include "simpio.h" #include "genlib.h" #include "string.h" [/CODE] None of them are necessary. [ICODE]if([COLOR="Red"]getchar(ch)[/COLOR] != EOF)[/ICODE] getchar() doesn't accept arguments, and returns an int. [B]i.e.[/B] [ICODE][COLOR="Green"]if ((ch = getchar()) != EOF)[/COLOR][/ICODE] [B]reverse() [/B]doesn't … | |
Re: >To have a doubt means that you understand something, and subsequently disagree with it. I doubt the correctness of this statement. Since doubt can arise out of uncertainty, due to lack of understanding. | |
Re: The function system() requires the inclusion of the header file stdlib.h instead of process.h If you run it at the CLI you'll see the output, now if you run it in some IDE, it might flash the output too quick for you to see it. >consider me Now, would you … | |
Re: [ICODE]for (i = 0; text[i] != '\0'[COLOR="Red"], [/COLOR]i++)[/ICODE] Change to a ([COLOR="Green"];[/COLOR]) [ICODE]gets(text);[/ICODE] Very, very bad idea. Forget there's such a function. Not safe. [ICODE]fgets(text, sizeof text, stdin);[/ICODE] is what you want. [ICODE]fflush (stdin);[/ICODE] fflush() accepts only an output stream; anything else is undefined behavior. [CODE][COLOR="Red"]int [/COLOR]CountVowels (char text[], [COLOR="Red"]counter_t … | |
Re: [QUOTE=TheNNS;664368]this is probably the worst thread ever. Daniweb has really lost quality in the last couple years.[/QUOTE] You are right. The very moment you signed up the decline in quality started. | |
Re: [QUOTE=Lardmeister;676523]Are we supposed to read all of these without getting brain damage? [/QUOTE] No possible risk of harm for you then. | |
Re: >So once a pointer to an array is declared as in the *str line, it can't be modified. I got it now. If you are referring to something like this [ICODE]char *str = "This is a string";[/ICODE] you are correct. It is better to think of it as a string … | |
Re: [ICODE]for(int i = 0; i <= 9; i++ ) [/ICODE] This should give you a warning unless you are using C99. Proper way: [CODE]int i; for (i = 0; i <= 9; i++) [/CODE] [CODE]for(int i = 0; i <= 9; i++ ) { if(charstring[i]=='0') intstring[i]=0; if(charstring[i]=='1') intstring[i]=1; if(charstring[i]=='2') intstring[i]=2; … | |
Re: >im having trouble [...] Can you explain what's the trouble you're having? What's the program doing that it isn't intended to do? | |
Re: Some to consider, [CODE] int HIGH=16; /*(Max value of an array element)+1*/[/CODE] That could be instead a constant[CODE]#define HIGH 16[/CODE] Now you can use HIGH as the subscript size of done, [CODE]int done[[COLOR="Green"]HIGH[/COLOR]]; [/CODE] All that, [CODE]time_t secs; time(&secs); /*assign 'secs' with the current time*/ srand((unsigned)secs); /*initialize the seed for … | |
Re: [QUOTE=mikedd;676276]...Cmon la tel me how to make the decimal putput tat read the output point zero one?[/QUOTE] I knew I should have keep my copy of the Rosetta Stone. | |
Re: >how to eliminate 1 from my program.it should be "date 08/06/08"..please help me.. These values returned to the variable [B]t[/B] are not quite ready to show in prime time yet. They are correct but some need to be formatted to show like you want. Functions like asctime() or ctime() can … | |
Re: [CODE] if(*num4>=70 [COLOR="Red"]&&[/COLOR] *num4<90) { if(num3>90) *grade='A'; else *grade='B'; } if(*num4>=50 [COLOR="Red"]&&[/COLOR] *num4<=70) { if(*num5>70) *grade='C'; else *grade='D'; } [/CODE] Substitute the (,) for what's in red. | |
Re: [QUOTE=Salem;682433]Well that would depend on how "string" is declared in your C program.[/QUOTE] And how Getline() and strrev() play with the ENTER key, as well. | |
Re: Please, take a look [URL="http://www.daniweb.com/forums/thread93280.html"]here[/URL] at how to properly tag your code, so it can keep the format for C language. That makes it easier to read. To start: [CODE] while ([COLOR="Green"]([/COLOR]getStu(spStu,&number,&stuID,&exam1,&final)[COLOR="Green"])[/COLOR] [COLOR="Green"]!= 0[/COLOR] )[COLOR="Red"];[/COLOR] { calcGrade (exam1,final,&total,&grade); writeStu (spGrades,number,stuID,total,grade)[COLOR="Red"]!=EOF[/COLOR]; }[/CODE] Remove what's in red. Add what's in green. | |
Re: [URL="http://www.freeos.com/guides/lsst/ch02sec04.html"]How to define a variable.[/URL] | |
Re: [QUOTE=olsoul_41;681243]Thanks but I like to do things on my way but still Tnx...[/QUOTE] If what you meant is that you like to learn at your own pace, and experiment and prove the conclusions you come with, as true, then I commend you for it. Just a word of caution: it … | |
Re: first declare an array of integers [ICODE]int ar[COLOR="Red"][100][/COLOR];[/ICODE] second use it inside the loop [CODE]for(int i=0; i<100; i++) { ar[COLOR="Red"][i] [/COLOR]=(rand()%100); cout<<ar[COLOR="Red"][i][/COLOR]<<" "; } [/CODE] | |
Re: [QUOTE=Narue;677810] >char *typed; >gets(typed); That's just brilliant. Not only did you fail to allocate memory to typed (who knows where those characters are being written), you chose to use gets despite the fact that it's impossible to use safely and ultimately one huge ugly wart on the face of C. … | |
Re: >I use the atoi function to do the conversion Take a look at strtol(), it would be better, atoi() has poor error handling | |
Re: Somehow we got infected with a strong case of [URL="http://i.ehow.com/images/GlobalPhoto/Articles/2023759/ostrich_head_in_ground_Full.jpg"]ostrich syndrome [/URL] | |
Re: [QUOTE=Narue;677741]>Hello guys this is my code. It's not often that looking at code can leave me speechless.[/QUOTE] :icon_biggrin: Glad of your prompt recovery, otherwise, I can not fathom what a post of yours, in full bloom speech mode would have meant. :P [QUOTE=Narue;677741] >int* cVec = (int*)malloc ( alloc ); … | |
Re: [QUOTE=MidiMagic;670012][...] If they don't use the code tags, they don't use the code tags. Ignore it. The polar ice cap won't melt because they forgot the code tags.[/QUOTE] Ignoring is going to make it worse. There's a reason why some forms of conduct are not allow in a cinema. [I][B]i.e.[/B][/I] … | |
Re: Before anything else you need to understand the basics. [CODE]char *typedword; / Accept a word from user printf("Enter the word"); gets(typedword); [/CODE] That doesn't work at many levels. [ICODE]char *typedword;[/ICODE] can only hold the address of a char. It can't hold the value of a char. [ICODE]gets(typedword);[/ICODE] is not an … | |
Re: [QUOTE=xitrum69;676177]in the main function, you have to replace the [B]displayArray (numbers)[/B] with the [B]display (numbers)[/B] function. Have fun.[/QUOTE] Or vice versa, that's why Salem said: "Be consistent!" | |
Re: memcpy requires the header file string.h malloc requires the header file stdlib.h | |
Re: [QUOTE=jobs;497707] I wouldn't know how max characters in the file, is there a way to tell C to just read until \n?[/QUOTE] Yes there's a way in C to just read until the '\n'. Nevertheless, that will not help you in what you want to do. Create a buffer with … | |
Re: If you give us your address as well, we can arrange to send you a complementary bouquet of flowers with it. Make sure you read details [URL="http://www.daniweb.com/forums/announcement118-2.html"]here[/URL]. | |
Re: Are you programming in C or in C++? [CODE]#include <cstdio> #include <iostream> using namespace std; [/CODE] All these belongs to the C++ language. [CODE=c]int main( void ) { /* needs to return 0; on success */ }[/CODE] | |
Re: [QUOTE=sneekula;671606] Here is an example in C language: [code=c]// spell a text string forward and backward #include <stdio.h> int main(void) { char text[80]; int k; strcpy(text, "Spell this string forward then backward"); printf("String = %s \n", text); // forward spelling puts a space between characters for(k = 0; k < … | |
Re: [QUOTE=Ene Uran;659078]I think the new Pope is quite hip! Let's support the poor fellow with your tax deductible donation![/QUOTE] In Spain the working people are obligated by the state to contributed to the Roman Catholic Church whether they want or not. This is accomplished via income tax, but is not … | |
Re: >I'm having a bit of difficulty doing it with no errors. What do you mean by "[B]...doing it with no errors[/B]"? You are missing the closing bracket for the function sort. Your formatting needs some work. It is kind of hard to read that way. [URL="http://www.gidnetwork.com/b-38.html"]A guide here.[/URL] | |
Re: >my future depends on you...-_- Then I wouldn't bet on your future. ;) Let's see where do I start? Ah, yes, use proper coding tags when you post some code in this forum. Example [URL="http://www.daniweb.com/forums/thread93280.html"]here[/URL]. [CODE] gets(new); [/CODE] Bad, bad function. gets() is not an alternative. Learn how to use … | |
Re: [QUOTE=mhil_joy;671073] [...] I hope that you will grant my request.. [/QUOTE] We would, if you would had granted our request for you to read the forum [URL="http://www.daniweb.com/forums/announcement118-3.html"]guidelines[/URL] and post in the established [URL="http://www.daniweb.com/forums/misc-explaincode.html"]standard[/URL]. Like [URL="http://www.daniweb.com/forums/thread93280.html"]here[/URL]. | |
Re: >Erm.. I think you are creating an array of 40 char pointers... Not sure tho. Nope, it is declaring a [B]pointer[/B] to an [B]array[/B] of 40 chars What you are describing would be: [ICODE]char *str[40];[/ICODE] | |
Re: [QUOTE=coolkeg;663652]hmmm now it is saying that "printf" and "scanf" are undefined functions in lines 10/11. the other code compiles fine though. thanks again. :P[/QUOTE] It is always best if you post a copy of the actual error given to you by the compiling/linking process. Paraphrasing errors and warning messages, frequently … | |
Re: if [B]i=1[/B] and [B]d=1[/B] would [B]d<i [/B]execute? What do you say? Would [B]if(t == i)[/B] have a chance of being execute without [B]t[/B] being initialized to any value? | |
Re: [QUOTE=Ancient Dragon;669497]Another method [code] char iobuf[] = "222 chris brown 50"; char* ptr; // find beginning of name while( !isalpha(*ptr)) ptr++; memmove(iobuf,ptr,strlen(ptr)+1); // find end of name ptr = iobuf + strlen(iobuf)-1; while(!isalpha(*ptr)) ptr--; // truncate *(ptr+1) = 0; [/code][/QUOTE] That obtains the string name out of the buffer, but … | |
Re: [QUOTE=plike922;669349][...] i tryied everything[/QUOTE] No everything. [CODE=c]int Fibonacci(int fnum) { int num1, num2, num3, fib; /* deleted n1, not needed */ num1 = 1; /* replaced 0 by 1 */ num2 = 1; /* changes in the loop: */ /* fig = 3 instead of fib=1 */ /* fig <= … | |
Re: [URL="http://www.google.com/search?hl=en&q=linux+check+if+a+file+exist+in+C%2B%2B&btnG=Google+Search"]knock yourself out.[/URL] | |
Re: [code=c] #include <stdio.h> int main() { printf("Hello World!\n"); getchar(); /* waits until user enters a key if the standard input buffer doesn't contain any */ return 0; } [/code] | |
Re: At the bottom of every forum's main page there's the list of moderators for that forum. Click on one of them and send an email. | |
Re: [iCODE]value=(int)argv[1];[/iCODE] That will not give you what you want. [iCODE]argv[1][/iCODE] is a string in the best case. Validate that the user entered an argument at the command line. Then use sscanf() to read that string into an int previously declared. [CODE=C] if ( sscanf( argv[1], "%d", &integer ) == 1 … |
The End.