5,676 Posted Topics
Re: [url=http://www.daniweb.com/techtalkforums/faq.php?faq=daniweb_policies#faq_keep_it_organized]See This[/url] | |
Re: [QUOTE=thekashyap;333746] E.g. change: [code=C++] cout<<"\n Welcome to the gas station\n"; cout<<"\n\nEnter the kind of fuel you want to buy\n\n-->"; cin>>carb; [/code] to [code=C++] cout<<"\n Welcome to the gas station\n" << flush ; cout<<"\n\nEnter the kind of fuel you want to buy\n\n-->" << flush ; cin>>carb; [/code][/QUOTE] Better (IMO): [code=C++] cout<<"\n … | |
Re: [QUOTE=ongxizhe;331184]Okay, but it doesn't seems to have any easy-to-use compiler. Is there any compiler that is just compile *.c format file instead of so many functions that makes itself more complicated than it's already is? Thanks.;)[/QUOTE] I don't understand this question at all. What compilers [I]don't[/I] compile *.c format files? … | |
Re: [QUOTE=n.aggel;334130]hi, i have this simple code, that compiles on visual studio 2005.When i try to run the executable through visual studio {pressign ctrl+F5} it does nothing{although the test.txt has size of 1kb}, when i run the exe through the command prompt the program works fine... Does anyone know why this … | |
Re: Looks like someone hijacked a thread and forgot to read [url=http://www.daniweb.com/techtalkforums/faq.php?faq=daniweb_policies]the Rules[/url] | |
Re: OK: [code] #include <stdio.h> int main(){char ch[]={83,111,114,114,121,44, 32,119,101,32,119,111,110,39,116,32,100,111,32,121,111,117,114, 32,104,111,109,101,119,111,114,107,32,102,111,114,32,121,111, 117,46,10,73,39,118,101,32,97,108,114,101,97,100,121,32,112,97, 115,115,101,100,32,109,121,32,99,108,97,115,115,46,10,0};int i= 0;while(ch[i]){putchar(ch[i++]);}return(0);} [/code] | |
Re: Please [url=http://www.gidnetwork.com/b-38.html]format your code[/url] so it's readable. I see this has already been suggested. Please do it... [code=c] switch(lose) { case 'y' : main(); break; case 'n' : printf("ok, see ya!\n"); break; }} }[/code] [B]Never[/B] call [INLINECODE]main()[/INLINECODE]. Put the program into a loop instead. Then you can simply read the … | |
Re: [INLINECODE]convert[/INLINECODE] is the [I]stringstream[/I] object. The [INLINECODE]convert[/INLINECODE] is true or false based on the execution of the >> operator. Therefore [CODE=c]if (!convert)[/CODE] actually says "[I]if the previous operation was not successful...[/I]" | |
Re: [QUOTE=aPPmaSTer;333488]Gotcha. I did a little work on it and so far this is what I got. For now I'm just trying to print each combo on a different line. [code=c]int arr[]={3,5,3,7,4},n=5; void combos(int pos) { int i; printf("%d",arr[pos]); if(pos<n) for(i=pos+1;i<n;i++) { printf("\n%d",arr[pos]); combos(i); } else printf("%d",arr[pos]); } int main() { … | |
Re: Boy is this thread full of BS :D 1) [I]cstdio[/I] is not deprecated. It is the C header for C functions fully allowable in C++. You don't deprecate a language... C is a [I]language[/I], not an old set of functions for C++. If you can offer a link stating otherwise, … | |
Re: [QUOTE=thekashyap;333750][B]Just a warning...[/B][code] printf("Beware the null char is not at teh end of supplied length: %s", equetion ) ; } [/code][/QUOTE] So? We aren't dealing with a string at this point. It's an array of characters. An array of character values does not need a null at the end. Only … | |
Re: Assume that [B]x[/B] becomes whatever value the problem says is input. Then, line by line figure out what each line is doing and fill in the number 'input' for x. What if anything is output? | |
Re: What kind of trouble? Unless you show us what you've tried, we can't help. Be sure to read [url=http://www.daniweb.com/techtalkforums/faq.php?faq=daniweb_policies#faq_keep_it_organized]this[/url] and [url=http://www.daniweb.com/techtalkforums/announcement8-3.html]this[/url] | |
Re: I would suspect you don't have space allocated for the array. How big is the array you defined? Or have you defined just a pointer? Can't tell from what you've posted. | |
Re: Are you in school? (let's assume you are for the moment) Do you have classmates? How many? And how many in the whole school? (let's use 1000) Would you want to define a single variable for everyone's name, then another for address, city, current class, grades so far..... That's 1000 … | |
Re: [QUOTE=Narue;324148]My favorite mouse is the [url=http://www.logitech.com/index.cfm/products/details/US/EN,CRID=2142,CONTENTID=10715]Logitech G5[/url]. [/quote] I use a similar optical cordless Logitech. Mine has 2 side buttons and only one under the scroller. GS model I think -- it's a few years old. [QUOTE=Narue;324148]My favorite keyboard is [url=http://www.logitech.com/index.cfm/products/details/US/EN,CRID=2166,CONTENTID=11868]this little beauty[/url]. The Logitech G11 gaming keyboard. [/QUOTE] I … | |
Re: First thing is [INLINECODE]for(int x = 0; x < (strlen(a)+1); x++){[/INLINECODE] will blow your array boundaries. You definitely don't need the [I]+1[/I] -- and probably want something like [INLINECODE]x < (strlen(a)-strlen(b))[/INLINECODE] instead. Then you need a loop within a loop: Search through [b]a[/b] looking for 1st character in [b]b[/b]. When … | |
Re: Unfortunately, that doesn't clear up the explanation. I [I]still[/I] don't know what he means. Maybe switch to FireFox... IMAO it's better anyway. | |
Re: Two things: Please [url=http://www.gidnetwork.com/b-38.html] format your code[/url]. It's very difficult to follow. And you input is not working the way you want it to. [url=http://www.gidnetwork.com/b-59.html]This series[/url] explains what is happening to you.[INLINECODE]cin[/INLINECODE] and [INLINECODE]scanf()[/INLINECODE] are really the same command. The first problem I noticed is your [INLINECODE]cin >> choice;[/INLINECODE] command. … | |
Re: Read [url=http://www.gidnetwork.com/b-59.html]this series[/url] on [INLINECODE]scanf()[/INLINECODE], esp the [I]character[/I] post. It will explain what happened. | |
Re: [QUOTE=nottoshabi;331597]How come on this line: bool FoodList::searchByName(char name[],Food& foodItem)const you used the [] after the name and not these ?() [/QUOTE] That means [I]name[/I] is to be used as an array in the function. [QUOTE=nottoshabi;331597]Joe head is asigned to a NULL. Does NULL mean is a empty paramiter?[/QUOTE] Yes. | |
Re: It seems that on line 10 you forgot to use the index onto your string array, so your bleglelstar gave a wrong gringledor 4 lines later. In other words, help with what? Don't you have to show us what's wrong, or are we supposed to write it for you? ;) | |
Re: You need to calculate the distance from (x1,y1) to (0,0). If < 1.0, you have a hit. And please use English, as the [url=http://www.daniweb.com/techtalkforums/faq.php?faq=daniweb_policies#faq_keep_it_clean]Board Rules[/url] request. This is not a chat room. ![]() | |
Re: OK, now that you've done his homework for him, will you get the grade for the program? :rolleyes: You [I]both[/I] need to [url=http://www.daniweb.com/techtalkforums/faq.php?faq=daniweb_policies#faq_keep_it_organized]read this[/url], and [url=http://www.daniweb.com/techtalkforums/announcement8-3.html]this[/url] | |
Re: [QUOTE=Derice;331227]i am a newbie in C++ file processing... Any1 can guide me to search for an item(lastname) in the example below? what is [B]seekg[/B] or [B]seekp... [/B]how to use it?[/quote] Not a clue what you are asking. Maybe you need to explain the problem. Remember, we're new to it so … | |
Re: I completely agree. Call them every few days to get an update. As for: [LIST=1] [*]Keep contacting the owner of a business feverishly until you secure the job. [*]Keep contacting the owner of a business until you are told : "No, now GO AWAY![/LIST] This must also be tempered with … | |
Re: [QUOTE=jwenting;331086]and don't mix stream io with oldstyle io.[/QUOTE] Meaning, use C++ style only, don't mix with [I]getchar()[/I], [I]printf()[/I]. IOW, anything from [I]stdio.h/cstdio[/I]. [QUOTE=rdsii64;331100]In an attempt to have cleaner code to work from with my next assignment, I made your suggested changes as well as a few more...[/QUOTE] If you post … | |
Re: [QUOTE=n.aggel;329869]hi,[/quote]Hi. [QUOTE=n.aggel;329869]i want to develop a console interface for a program that i made{a university project}...... so i was wondering if anyone {with expertise in this matter} can supply me with links or examples..... For example , i am searching for ascii art...and also for ways to create menus with … | |
Re: [QUOTE=Jishnu;330868]Hello eveyone, I am working on a program that uses the graphics.h library functions and the 0x33 mouse interrupt. When I click at a particular place on the screen, the graphics nearby the mouse are saved and displayed on the new screen (that appears due to the mouse click) when … | |
Re: I would do it like this: [code] 1. Ask the user for file name of file they wish to write data to. 2. Store file name in to a variable. 3. Open file. 4. If file not open issue an error message else Start a loop: A. Enter user data. … | |
Re: locate the element that contains the value you want removed. Then move all lower elemenets up one place to overwrite that elemement. That will leave the last element of the array unused. Then call realloc() to allocate the array 1 element smaller then it was before. But for something like … | |
Re: Compare the string with "source:" using [INLINECODE]strncmp()[/INLINECODE] then use [INLINECODE]strcpy()[/INLINECODE] using the form [I]&buf[7][/I] to point after [I]source:[/I] | |
Re: [QUOTE=notfornothing21;330861]Thank -- not sure why you are being snotty for I think that for a first time Linked Lister, I am not doing too bad of a job.[/QUOTE] [B]Joe[/B] wasn't being snotty, he gave you the suggestions you needed, all 3 of them. And we have no idea what this … | |
Re: [QUOTE=bobcats;330072]Sir I appreciate your suggestions but I'm really a noob with regards to C such that i don't know how to implement it. Could you give me any sample/hint. Sorry for being very slow with this part. Hope you could understand.[/QUOTE] Follow [B]Dave[/B]'s suggestion at your [url=http://www.gidforums.com/showpost.php?p=57641&postcount=14]GID post[/url]. With all … | |
Re: You have to know what F1 actually is when you press it, and code for that. As it is, I don't see anywhere you actually defined the value you expect for the key. And since [INLINECODE]getch()[/INLINECODE] returns an int, and in the function you cast everything to ints anyway, why … | |
Re: Do you know what a loop is? Both programs require at least one loop and an IF statement. | |
| |
Re: [b][color=blue]17 Truths[/color][/b][list] [*]Men are like slinkies...not really good for anything, but you still can't help but smile when you see one tumble down the stairs. [*]I read recipes the same way I read science fiction. I get to the end and think, "Well, that's not going to happen". [*]Health nuts … | |
Re: [QUOTE=XpatienceX;330142]Hi, I need some input on an assignment I am doing. I am not sure if I even did this assignment right or not. So any help would be appreciated.[/quote] OK. Input is: Start writing the program. Write the input module and test it. Write the output module and test … | |
Re: > Hmm something removed all my tabulation which made code soooo much easier to read. > Anyone know how to keep tabs in code blocks for legibility? Change your TABs to SPACEs. There is probably a setting in your IDE options. As for `system("pause");`, [see this](http://www.gidnetwork.com/b-61.html). Put your `cin.get()` in … | |
Re: [QUOTE=happygeek;329868]... keeping an eye on the porn... bloggers - but I do that anyway.)[/QUOTE] Hmmmm so [I]that's[/I] what you do... :mrgreen: | |
Re: [QUOTE=pupsia;320746]Oh.. I forgot to asc... whether this programe is in C language??... If not I have I problem :( I need a programe in C..... ;([/QUOTE] Please learn to [url=http://www.gidnetwork.com/b-38.html]Format your code[/url]. Yours is hard to read. To convert to C simply use [INLINECODE]printf()[/INLINECODE] for output, and [INLINECODE]fgets()/sscanf()[/INLINECODE] combination for … | |
Re: [QUOTE=niceliang84;328512]i cant paste all the coding here cause it is too long and involve many different CPP file,[/QUOTE] So post just the code section you are asking about. With details about what is going on and how the variables are defined, we can usually read code segments easier than 100s … | |
Re: OK, since you are new, allow me to correct things in your program first before tackling the coding of the problem. By the way, what's an [I]erm[/I]? ;) Problem#1: [url=http://www.gidnetwork.com/b-38.html]Format your code[/url]! You need to learn to indent your code properly so it can be followed, and it's better to … | |
Re: Let's fully parenthesize the comparison, shall we? No sense going half way and this remove [B]all[/B] ambiguity: [code=c] // will be executed atleast once do { // something } while (((first < second) && (third != fourth)) || (iterations < 5)) ;[/code] | |
Re: [QUOTE=BiGPrO;287578]Thanks for your feedback thoguh, very fruitful, you didn't have to take the efforts, next time I guess no need to ask, better live in ignorance![/QUOTE] Don't do that! I agree with you that if you've never come across a problem before you don't always know if there are hidden … ![]() |
The End.