2,827 Posted Topics
Re: Looks to me like your data input file is incorrect. [code=text] 3 123 456 789 [/code] Note the lack of spaces between the digits. I assume you want this: [code=text] 3 1 2 3 4 5 6 7 8 9 [/code] Note the spaces. The >> operator treats the spaces … | |
Re: [QUOTE=restrictment;1169826] so I 'suppose' it is a bandwidth problem..[/quote] Bandwidth has nothing to do with it. You need to use more precise terms. [QUOTE=restrictment;1169826] however 255 lines of text is like nothing [/quote] Could be nothing, could be something. If you reserved space for 254 lines, it would be something. … | |
Re: Garbage in, garbage out. Uninitialized values are usually garbage, so make sure you don't have any. To check, initialize them all to something like -999999. Then if you are using them anywhere, it'll stand out like a sore thumb. | |
Re: [QUOTE=Pynolathgeen;1170590]Oh btw, it prints the error on the Command line, I don't get that Dialog =P. Maybe it is important to tell?[/QUOTE] You don't get WHAT dialog? Nick is correct. The possibilities are endless. You have to track it down somehow. If it's running on a server, it may be … | |
Re: [QUOTE=Luks;1170934]I have tried following the instructions on the website and done everything the way it is explained, but still the error is coming up. Any furthere suggestions on how to fix this error.[/QUOTE] [LIST=1] [*]Path is screwed up with either spaces and/or slashes going the wrong way or being interpreted … | |
Re: [QUOTE=mommie;1170862]It compiles but no matter what I use for n and k I get 0. I tried using n=6 and k=1 and got 0. I tried using n=52 and k=25 and got 0.[/QUOTE] It doesn't compile. Look at line 56. Fix that, then look at the "loop" on line 59 … | |
Re: You had another thread recently on a very similar topic that I responded to and you never responded back. [url]http://www.daniweb.com/forums/thread262999.html[/url] I don't know if this is the same problem or not. If you post 1200+ lines, you should point us in the right direction. A few things stand out: Line … | |
Re: [QUOTE=juniper2009;1169844]I would be very happy if you could explain to me clearly to understand the void insertAtRear() function. I want to make an insertation like void insertAtRear(int i, string s, string n) { //how can i implement this function // i need to }[/QUOTE] No, we can't explain clearly because … | |
Re: Well, it doesn't work for 500 numbers. Are there actually 500 numbers in the file? If not, you shouldn't be sorting 500 numbers. Does it work for something less than 500? Is -858993460 even in the file? If not, look at that. There is reading in an array from a … | |
Re: [QUOTE=MyrtleTurtle;1167257]Do you mean that you don't want to have to press enter after each (one character) number is entered? [/QUOTE] I interpreted the OP's request differently. To the OP, you should clarify what exactly you are looking for. MyrtleTurtle might have interpreted in correctly and I didn't. I thought the … | |
Re: Code tags. Use them. [noparse] [code] // code here [/code] [/noparse] [code] cout << "Enter five test scores for student number " << N << endl; cin >> score[0]; cin >> score[1]; cin >> score[2]; cin >> score[3]; cin >> score[4]; average = (score[1] + score[2] + score[3] + score[4] … | |
Re: [QUOTE=MosaicFuneral;1167370]You're confusing the lax C++string container method with the C way. [url]http://www.thinkage.ca/english/gcos/expl/c/lib/strcmp.html[/url] [url]http://www.cplusplus.com/reference/string/operators/[/url] edit: Wow, everyone replied at the same time.[/QUOTE] Yep, they sure did. What the hell, I'll post mine anyway. [code] #include<iostream> using namespace std; int main() { char felix[3] = "ho"; if(felix == "ho") cout << "1. … | |
Re: [QUOTE=tarheelfan_08;1163856]But my question is, do I create the binary file first in the program or by hand or what?? I have read from a text file before but never a binary file. [/quote] In order to read from a binary file, there must be a binary file to read from. … | |
Re: [QUOTE=Sorb3t3ro;1164561]And if I use [B]if (value < = 0)[/B] the program only takes 2 seconds to display the output if I run the program [COLOR="Red"]right after compiling[/COLOR], but If(value < = 0) will make the program exit the sequence if the user enters a 0 and thats not what I … | |
Re: [QUOTE=The 1;1164429]Help people hows it going? I need some help with a bubble sort algorithm, i basically have to use a bubble sort to look through a number of car registration numbers and put them into ascending order... Im just not quite sure how to get it done... I asked … | |
Re: Whenever you use a getline right after using a >> operator, problems have the potential to occur if you don't clear the input stream. You say you used ignore, but I don't see where you used it (except when you test for cin.fail ()), so I can't comment. Narue has … | |
Re: import java.util.ArrayList; public class Sum extends ArrayList<Integer> { ArrayList<Integer> num = new ArrayList<Integer>(); num.add(1); num.add(13); num.add(24); num.add(65); num.add(67); num.add(89); return (num); public Integer Sum() { Double subtotal = 0.0; for (Double d : num) { subtotal += d; } } } Lines 5 through 14 just appear to be floating … | |
Re: [QUOTE=evstevemd;1165685]where is the problem? Does it compile? Errors?[/QUOTE] In addition, [LIST=1] [*]You only need one thread. [*]What's a scanner? [*]What's oberon? [*]Who wrote this code? [*]Use code tags. [/LIST] | |
Re: Whenever you mix the >> operator and getline or get or getchar or whatever, you have that pesky whitespace that one leaves behind and the other treats as valid, so you either have to use cin.get() twice (first to get the newline character, then to pause) or you need to … | |
Re: [QUOTE=missmedude;1165496]yes. But I dont't know how. Is there like a source code or anything for it?[/QUOTE] [LIST=1] [*]4 lines [*]Number of asterisks in the line is a formula based on the line number. [*]Number of spaces before the first asterisk is a formula based on the line number. [/LIST] [code] … | |
Re: [QUOTE=fugnut;1165342]I have to write a program that reads in from a .txt file similar to 12345 Il 4350 (sales number, state abbreviation, amount) for the most part I dont have an issue with this, however I have to read in the State abbreviation as separate characters and ultimately alphabetize them. … | |
Re: [QUOTE=techie929;1165390]When I use strcat I get the below error: invalid conversion from 'unsigned char*' to 'const char*' error: initializing argument 2 of 'char* strcat(char*, const char*)'[/QUOTE] Post the code. | |
Re: [QUOTE=Christoph928;1165504]Sorry I know this is a long post, but I am stuck and would appreciate the help.[/QUOTE] Stuck WHERE? Describe the problem. Does it compile? Does it run to completion? Does it give inaccurate results? Do you need help designing it? Point us to a specific problem and specific line … | |
Re: Looks like your program got cut off, but I think the general gist is this. Programs like this are sequential. One thing happens at a time. You are either beeping, calculating, waiting for input, display, calculating, whatever. Two things can't happen at the same time in most programs. If you … | |
Re: Indentation will make the code easier to follow. I'd probably approach the problem like this: [code] double sinx = 0; double term; double tolerance = 0.00000001; double x; // code do { // code // calculate term sinx = sinx + term; // code } while (fabs (term) > tolerance); … | |
Re: Is this a code snippet? A question? What? Use code tags too please. [noparse] [code] // code here [/code] [/noparse] | |
Okay, I think I know the problem, but I don't know how to solve it. I want to write a binary file with raw bytes. Windows appears to interpret 10 as ASCII 10 and it does its thing where it interprets 10 as '\n' and decides to change that to … | |
Re: [QUOTE=reza.adinata;1164404]But the question is that, how to show output of all inputs within the array? not just each element.. Example, I want to type " MY NAME" and i will get the result of " MY NAME ". I tried to use char, and it ends up showing only "MY" … | |
Re: [QUOTE=timbomo;1156468]Im trying to figure out how i will calculate items needed. for example for every 500 sqft of space, one gallon of paint and 8 hours of labor is required. how will i put that n to a formula[/QUOTE] The formula will depend on what you are trying to calculate … | |
Re: [QUOTE=unbrknchane;1162048]well theres no error. lol....the problem is it keeps seating people in seat 0 and saying that seats 0 0 0 0 are available. it runs fine but my array is screwie i guess...[/QUOTE] Yes, there is an error. You're describing the error. So no, it doesn't run fine. It … | |
Re: Using "sizeof" here seems problematic. I don't know where you are declaring answer, but remember that sizeof is not the number of elements in an array, but instead is the amount of storage required. I'd have to see how/where you declare everything, but I'm guessing you don't want "sizeof". A … | |
Re: I'm an array kind of guy (enums will work just fine too). This code snippet might give you some ideas. Look at lines 42 - 44 and lines 175 - 182. Random indexes are generated, then get your card by looking up the array value for that array index. [url]http://www.daniweb.com/code/snippet217203.html[/url] | |
Re: Regarding the filenames, this won't work: [code] ifstream source, file1; ofstream output, file2; cout << "Please enter the name of the input and output files" <<endl; cin >> file1 >> file2; source.open(file1); [/code] I'm going to rename file1 and file2 to filename1 and filename2 to make the names more clear. … | |
Re: The question is too vague. Give us an example of a string and the appropriate substrings for that string. | |
Re: [QUOTE=habib_parisa;1156781]Dear all, I have to use a funny structure in my code which has a 2D array and allocate it later in the program. I do it but I get error which is written below. I have urgently to finish this part of the code. Would be agreat help if … | |
Re: First, get the number of cout statements per line correct. You have a nested loop. Let's look at the first iteration of the outer loop: [code] int count = 1; for(int i=0; i<n; i++) { for(int y=0; y<(k-i); y++) { cout << count << " "; count = count * … | |
Re: [QUOTE=mattjbond;1153464]I am curious about how to post or have published tutorials. I have searched the forum but the latest information I cna find is years out of date. Any help here?[/QUOTE] Happy Geek and/or SOS handle those, I think. They have some fairly stringent standards, I think. Most people who … | |
Re: Three of my four code snippets involve shuffling and random numbers without repeats. There is more than one way to do this. Here are my snippets: [url]http://www.daniweb.com/forums/search4218181.html[/url] So I assume that your code is misbehaving in some way? What is it doing that it shouldn't or what is it not … | |
Re: Lines 198 and 203. You cannot declare the same variable twice. Try deleting line 198. | |
Re: [QUOTE=harneet singh;1155150]can anybody help me how i can jump proxy server and firewalls to open an orkut in user account....[/QUOTE] No clue what an orkut is, but I feel pretty confident that no one is going to help you on this. This ain't that kind of forum. | |
Re: Start with the Caesar Cipher and go from there. There are a bunch of algorithms out there and most of them are public, so you can find an already written program and check your answer against that. | |
Re: [QUOTE=rahulms;912848]thanks for taking the time to reply back. Fortunately, I got the thing to work with class files, however, I am still struggling with jar. can you provide me with the syntax. I used the old thread, since it described the context I was looking for. tkd[/QUOTE] You are better … | |
Re: I'm not 100% sure what the problem is or what the text file is exactly, what the rest of the program looks like, and what the actual and desired output is, but I ran this program: [code=CPP] #include <fstream> #include <cstring> #include <iostream> using namespace std; int main () { … | |
Re: [QUOTE=faaz;1144491]btw heal brains it would make me feel very happy if you did this for me anyway it is late two weeks and the max i can get on this assignment is 8/10.[/quote] That's not the way the forum works. You do it, we help. Heal Brains would be breaking … | |
Re: [QUOTE=needhelpbadly;1144286] This is supposed to be in a diamond formation. Hopefully it posts that way. [/QUOTE] No, it doesn't post correctly. You need to use code tags. [code=text] * *** ***** ******* ***** *** *[/code] And it still won't display correctly (see above) since you need to use a Courier … | |
Re: Stick some debugging code in there that displays things to the screen in order to verify that what you think is happening really is. Make sure that both the output and file and the input file are both opening and writable. Beyond that, display the value of ch both before … | |
Re: Decide what 0 degrees, 90 degrees, 180 degrees, and 270 degrees are. Normally they are east, north, west, and south respectively (or right, up, left, down). See chart here: [url]http://en.wikipedia.org/wiki/Polar_coordinate_system[/url] Moving west makes x decrease. Moving east makes x increase. Moving north makes y decrease. Moving south makes y increase. … | |
The code below compiles, runs, and gives correct results. Note, however, the commented out "Experiment" code. I want to be able to call a function which accepts a variable number of parameters, which then calls another function and passes it those parameters. How can I fix the commented-code so that … | |
Re: You need to find out exactly where, when, and under what conditions this seg fault happens. There's more than one way to program a binary search tree. I would have the search and delete functions separate. You are searching inside your delete function. I don't think you should do that. … | |
Re: [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] |
The End.