5,676 Posted Topics
Re: [QUOTE=logicmonster;1143033]How did you solve this? I'm having basically the same problem.[/QUOTE] What makes you think after two years this guy is just waiting around for you to ask this? If it's the same problem, try reading the thread and get the same help he got. | |
Re: Opening a file requires a C-style character array, not a C++ string. [B]Jonsca[/B] has posted your answer. I just thought I add why. | |
Re: I suggest displaying all the values before and after you try the insert. Display the array, used, current_index, and any other variables that will help you figure out the problem. Run the code in the debugger is also a good idea. | |
Re: You're welcome in retrospect. Why did you post this? What kind of response are you expecting? you didn't even ask a question. | |
Re: [QUOTE=logicmonster;1142914]cin.get() isn't doing anything, its just sitting in your code trying to look pretty and getting in the way :)[/QUOTE] Not if you run the program in an IDE. [QUOTE=sgw;1142917]Yes, after adding "flush", the output came out! Thanks! Been doing C++ for a long while but never noticed this problem. … | |
Re: [QUOTE=ELBUF;1142401]I think I can identify where the problem is, I just have no idea how to go about fixing it or even trying something different.[/QUOTE] Care to share where you think the problem is, or is it a secret? | |
Re: [QUOTE=turrence27;1142882]1>d:\my documents\visual studio 2008\projects\idontknow\idontknow\ddd.cpp(13) : error C2228: left of '.Length' must have class/struct/union 1> type is 'int'[/quote] Since when does an [ICODE]int[/ICODE] have a [ICODE].Length[/ICODE] member? [QUOTE=turrence27;1142882]1>d:\my documents\visual studio 2008\projects\idontknow\idontknow\ddd.cpp(15) : error C2109: subscript requires array or pointer type[/quote] [B]CardNumber[/B] is an [ICODE]int[/ICODE], not an array. [QUOTE=turrence27;1142882]1>d:\my documents\visual studio 2008 … | |
Re: [QUOTE=DARK_BYTE;1142766] This line is supposed to cause that error: [CODE] myArray[count].address=line.substr((myArr[1]+1),(myArr[2]-(myArr[1]+1))); [/CODE] I can't understand why it says its out of range when the pos and length I supplied is valid.[/quote] Are you [I]absolutely[/I] sure? Maybe you need to print out all the values you are using just before the … | |
Re: You need to ask a question about what you don't understand. Not just post your assignment: 1) it looks like you want us to do it for you 2) we have no idea what you're having trouble with When posting, details are more important than posting the assignment. | |
Re: Consistent [url=http://www.gidnetwork.com/b-38.html][B]formatting[/B][/url] will solve these problems in moments. | |
Re: [QUOTE=The Pobo;1137372]Hey, I'm a student with rudimentry knoledge of VB6 and I've a college project where I have to develop a blackjack game. Unfortuanately I've a problem with the method I call the cards I was wondering if any of you would be able to shed some light on the … | |
Re: While you're googling, google for [I]satire[/I]. | |
Re: I don't see a problem. Maybe you should post the entire error, not paraphrase it. Wonder if it has to do with using [B]math.h[/B] instead of the C++ [B]cmath[/B]. I doubt it, but [B]cmath[/B] is the correct header. | |
Re: Good job. nicely formatted code, but you used [iCODE]conio.h[/iCODE]. What grade did you get? | |
Re: Because you are expecting the language to do the work for you. When you read strings, [I]you[/I] need to deal with the strings yourself. And since we have no idea what you are reading and trying to do, it's hard to point you in a direction. You need to understand … | |
| |
Re: As you loop through the equation, remember the position of each ( you see. When you see a ), extract everything between the ) and the last ( you saw. Replace these characters with SPACEs to clear out the extracted section. "Unremember" the ( location since it's no longer there. … | |
Re: [QUOTE=yznk;1141985]I fixed up my code some and now the program runs, but it crashes after entering the rows and columns. Im not sure why, why is it crashing and not finding the number of steps?[/quote] It crashes? Then it doesn't run, does it? :icon_wink: You should know by now that … | |
Re: [QUOTE=Will Gresham;1115869]I have connected to the IRC a few times, but no-one is ever on when I do :)[/QUOTE] Makes sense. With the 8 or so people that use it, the chances that any one of them are on at the exact time someone enters the IRC is slim at … | |
Re: With your lack of [url=http://www.gidnetwork.com/b-38.html]formatting[/url] I must be missing the [ICODE]for[/ICODE], [ICODE]do-while[/ICODE], or [ICODE]while[/ICODE] statements that start your loop | |
Re: [QUOTE=its_yogy;1141621]// Also i wud be happy to ...[/QUOTE] And we [B][I]would[/I][/B] be happy if you'd use CODE tags and [url=http://www.gidnetwork.com/b-38.html]format your code[/url] | |
Re: We don't know where either, but there certainly is one missing. It all depends on what is part of your function and what isn't. | |
Re: In the same scope, yes. In different scopes, no. But it could be very confusing to anyone reading the code. Generally not in functions as you have them, though. Be careful if defining variables within code blocks ([ICODE]if[/ICODE], [ICODE]for[/ICODE], [ICODE]while[/ICODE], ect) | |
Re: Look up the [ICODE]unload[/ICODE] or [ICODE]terminate[/ICODE] event handlers for your form. | |
Re: [QUOTE=anthony5557;1141037]Can anyone help me tweek my code. This program is supposed to get the day number 1 through 365 from the user and display the corresponding month and day. I'm getting so many errors I don't know how to start or really decipher the error in C++. [/QUOTE] Gee, my … | |
Re: [QUOTE=VernonDozier;1141592][LIST=1] [*]Use code tags. [*]Is this a code snippet? You don't have it flagged as one. [*]If not, what's the question? [/LIST][/QUOTE] Don't mention Code Snippet! They are posting enough Code Snippets already that we have to edit! :icon_twisted: | |
Re: [ICODE] for(int x=2; x<(number/2); x++)[/ICODE] Start a loop from 2 to [B]number/2[/B], incremented by 1 If [B]number[/B] is 10, loop through 2,3,4, [ICODE] {[/ICODE] [ICODE] while(number%x==0)[/ICODE] Another loop -- when the [I]remainder [/I]of [B]number/x[/B] is zero exit the loop [ICODE] number/=x;[/ICODE] Divide [B]number/x[/B] giving a new [B]number[/B] [ICODE] }[/ICODE] | |
Re: Read the file line by line and when you get to the line you want, stop. Might need an [iCODE]if[/iCODE] statement | |
| |
Re: Look up a [B]bubble sort[/B]. That is the easiest sort to implement. | |
Re: Look up the function [iCODE]isalpha()[/iCODE] and test each character after you read the line. Also, [url=http://www.gidnetwork.com/b-56.html]see this[/url] about gets(). And [url=http://www.gidnetwork.com/b-38.html]see this[/url] about formatting. Yours is not very good. | |
Re: You start by choosing a language Look you the for loop Add code to support the loop | |
Re: You open the files in [ICODE]main()[/ICODE], you don't check if they opened properly until you've called your function. Bad form. Open and check immediately. That way you don't waste time and confuse your brain cells later. Then you use [ICODE]scanf("%s"...)[/ICODE] which is dangerous. [url=http://www.gidnetwork.com/b-59.html]See this[/url], then jump to Part 7. | |
Re: Here's what I see: [code] std.open("std.txt"); if(std.is_open()) // Why are you doing this? { std.seekg(0, ios::end ); // Jump to bottom of file fstd = std.tellg(); } // If open failed, why are you trying to read? std.read(st,fstd); // You've jumped to the end of the file std >> st[n]; … | |
Re: [QUOTE=EvilNerd;1140766]when i try it to add i and compile the code i got errors and warnings. And when i try to run the program it gives me an abort message with red x on it.[/QUOTE] Gee, since there are only about 2000 possible errors, all we can say is "you … | |
Re: [QUOTE=jameslat;1140800]Hey everyone! this is my first post at this forum:P[/QUOTE] We know. It's in the header with your name... ;) [QUOTE=jameslat;1140800]Please go through and answer what question you can[/QUOTE] Sure. [QUOTE=jameslat;1140800]is anyone willing to help me?[/QUOTE] Yes. If you had actually asked some questions, this reply might be more useful. … | |
Re: [QUOTE=dinamit875;1139760]Hi, there, I have written a program here which shows plane to book a seat, and enter flight info(this part works fine)... but having some small problem here I am using gotoxy and it gives me an error, it says that gotoxy undeclared. Could anyone help me with this please, … | |
Re: [QUOTE=rom87;1138381]hi Im trying to make this code go though every possible string combination at said string length though alpha characters using random number generator to do so.The goal is to make this program tell me how many combinations there are at said circumstances set by user.[/QUOTE] Said problem is confusingly … | |
Re: You have to deal with the array index and the loop index [B]i[/B] separately. Only increment the array index if -1 is not read. If you see the -1, do not increment the array index. | |
Re: A mid-90's [I]Alicia Silverstone[/I] movie pops into mind for some reason. | |
Re: First thing I see is using C-style headers and C input. Get rid of all the C headers ([ICODE]conio.h, stdio.h[/ICODE]) and stick with [ICODE]iostream[/ICODE]. With that, don't use [ICODE]_getch()[/ICODE]. Use C++ input commands. [ICODE]math.h[/ICODE] should be [ICODE]cmath[/ICODE], the C++ version. Fix that and if still a problem, describe in greater … | |
Re: [QUOTE=gerard4143;1140023]Is this me or does this look like C++ list<item_set> candidate_set;[/QUOTE] Nope. Not just you. Please clarify, [B]johndoe444 [/B] | |
Re: Nice! Question. Why did you resurrect a two year old thread asking a question that has no real relation 1) the the thread itself? 2) to the language the forum is about? | |
Re: [QUOTE=techie929;1140250]I have to create a bst in which i have to add string values in the nodes..I have to display the no of nodes inserted each time..When I insert small string like..FA or B...i am getting the correct value in count[count is the variable which I have taken to count … | |
Re: You don't need a user defined header file for this program unless you make two .cpp files. hint #2- overloaded | |
Re: [QUOTE=PDB1982;1137706]My problem lies in the fact that the teacher might try to say that I own more than three stands, so then what happens!?!. I'm thinking that there might be a loop or array that would be a little better.[/QUOTE] Since the teacher mentions [I]at least three[/I], this would be … | |
Re: [QUOTE=Aia;531348]Avoid using Miracle C. The Miracle would be if it works correctly at all. There are plenty good free compilers to choose. Look in the starting C post at the beginning of the forum.[/QUOTE] I went to their website for the first time today. It [I]claims[/I] MC is still under … | |
Re: Post the freakin' errors. We can't help you if you keep the errors a secret. | |
Re: When you loop through the line you convert only the digits. But if one of the locations is not a digit, not only do you skip it in the source string, but you also skip the same position in the destination array -- leaving uninitialized data in that position. | |
Re: Why are you resurrecting a 6 year old thread as if you have something to add? |
The End.