2,827 Posted Topics

Member Avatar for Fumomo

You're going to need either a new array to represent the combined values or you need to use the old array and delete some elements. You're sending data to the file too early. What if there are THREE records with the same date, not TWO. Assuming you don't need to …

Member Avatar for drkybelk
0
125
Member Avatar for Gsterminator

You should verify that you are indeed in an infinite loop and find out where exactly. Make sure it's not a program crash or something. Putting some println statements in the loops should do the job. If they print forever, you're in an infinite loop. Line 79 is going to …

Member Avatar for Gsterminator
0
256
Member Avatar for justinwarner

>> I'd like not to use the Collection.sort as I've tried for a while, and I think it's beyond my abilities... Anyone have any ideas? Even if it's just psuedo or anything, doesn't have to be actual code. if you don't want to use the "sort" function, don't, but you'll …

Member Avatar for VernonDozier
0
184
Member Avatar for alex55

Nothing in the code keeps track of how much REAL data you actually have. You have records of real data, so this will display 4 records of real data, then 6 records of garbage. You'll want to set up a new variables and change the code so that it flags …

Member Avatar for alex55
0
171
Member Avatar for akase2010

>> I dont even know where to start. Start by writing a main function that asks the user for input, the passes that value to the function and have the function just return that value. Then print it out in main. After that works, start writing the real function. Before …

Member Avatar for VernonDozier
-1
169
Member Avatar for Mayank23

[QUOTE=Mayank23;]how can i use a string in a switch statement?[/QUOTE] You can't. You can only switch on "integral types" like char and int. You need to do a bunch of if-else if statements for strings.

Member Avatar for Fbody
0
261
Member Avatar for alexchen

One (system("pause")) involves asking the operating to run a system command and spawn a new process and the other simply waits for input to your program. They are about as different as night and day. As to which to use, cin.get() is usually preferred. If you do a quick Daniweb …

Member Avatar for VernonDozier
0
349
Member Avatar for plasticfood

The way you have it set up, I imagine it is THIS: [code] public void setLab(Grade g, int index) [/code] Otherwise how do you know WHICH grade to set. Setters and Getters don't do much. They are usually one line functions. The key is the "public" versus "private" modifier. grades[] …

Member Avatar for plasticfood
0
116
Member Avatar for stephy1

This is an error: [code] int i = 0; String bogus[i]= ""; [/code] Perhaps you wanted this? [code] int i = 0; String bogus[] = new String[10] bogus[i]= ""; [/code] This line would be an error no matter where you put it: [code] String bogus[i] = ""; [/code]

Member Avatar for VernonDozier
0
176
Member Avatar for Nandomo

>> I know how to do palidnromes with strings, but don't know if there is an easier way with integers Then covert to a string and do the palindrome check. I don't see a [ICODE]bool IsPalindrome(int)[/ICODE] function anywhere. Don't you need one? One way or another, you need to isolate …

Member Avatar for Nandomo
0
116
Member Avatar for Lemonader

I've never heard of Roman Decimal Numbers either and I'm trying to picture how you would differentiate 1.1 from 1.01 without a zero. I would confirm they exist and write out several examples on paper before attacking the C++ angle of it. [EDIT] Never mind. I had a terminology problem. …

Member Avatar for WaltP
0
1K
Member Avatar for Mayank23

>>i give him to him by a download link, its a .exe file then he double clicks on it and runs it, but then the program just goes away quickly. But what kind of program is it? If it's a console program, once the program exits, with or without an …

Member Avatar for Nandomo
0
144
Member Avatar for alex55

Two possibilities: [LIST=1] [*]Garbage in, garbage out -- The calculation code is not getting the input you think it is, so it's giving bad results. [*][*]Good data in, garbage data. The data being delivered to the calculation code is valid, so the calculation code is wrong. [/LIST] Figure out which …

Member Avatar for VernonDozier
0
104
Member Avatar for Szeth

Not pertaining to your question, but important enough to point out... You should move line 35 up to the top of main. It needs to be executed once and exactly once. Sticking it in the while loop as you do makes numbers less random, not more random. As to your …

Member Avatar for Szeth
0
2K
Member Avatar for aznlitomik3

Here's a decent iomanip tutorial: [url]http://www.cprogramming.com/tutorial/iomanip.html[/url] If you scroll about halfway down, you'll see an example. For some reason they have the entire webpage as a link so I can't copy and paste the code. Look for "Setting the precision of numerical output with setprecision". There are some examples on …

Member Avatar for VernonDozier
0
225
Member Avatar for VernonDozier

OK, here's what I want to do (I realize the code below doesn't work, but it's what I would LIKE to do). I've converting things from C++ [code=JAVA] public void ChangePrimitiveArray(byte bytes[]) { bytes[0] = 1; } public void foo() { byte bytes[] = new byte[2]; bytes[0] = 4; ChangePrimitiveArray(bytes); …

Member Avatar for VernonDozier
0
216
Member Avatar for Zvjezdan23

In addition to the post above, line 80 is confusing. [code] cout << main(); [/code] I suppose it might work to call main() from your program (but it's not a good idea. There are better solutions), but what are you trying to do with the "cout" part of that line?

Member Avatar for alaa sam
0
189
Member Avatar for AmerJamil

>> i have no idea please help :( Ancient Dragon's right. Try it yourself first. #2 and #3 should not have been posted. All you had to do was compile and run them and you'd know the answers. #1 is less obvious. Now what precisely is your question? You need …

Member Avatar for VernonDozier
0
128
Member Avatar for Java-Newbie

You are not telling the compiler what type "canal" is. I am guessing that "canal" is an integer, but you don't specify this: [code] public void sincronizarCanal(canal) [/code] If canal is an integer, you should change it to this: [code] public void sincronizarCanal(int canal) [/code] However, this also won't work …

Member Avatar for javaAddict
0
6K
Member Avatar for Crutoy

My critique would be the following. The code is difficult to read, at least to me. iCounter, iNumber, iRemOfOriginal, etc., these are all variable names that are not obvious to me so it's hard for me to follow the logic. The task seems fairly straightforward. [LIST=1] [*]Isolate the digits. [*]Manipulate …

Member Avatar for Crutoy
0
88
Member Avatar for VernonDozier

See title and screenshot. This photo came off an XP computer, was burned to a disk, and I'm attempting to copy it to a Windows 7 computer. I'm logged into an accout with Admin access. It transferred no problem onto an XP computer and transferred no problem from the CD …

Member Avatar for Michael Truman
0
444
Member Avatar for Narue

If any of you are assuming I look exactly like Ryan Reynolds wishes he looked, I have to congratulate you on being 100% correct.

Member Avatar for bumsfeld
6
256
Member Avatar for Nandomo

[code] for(int i = 0; i [COLOR="Red"]>[/COLOR] NUM_IN_TEAM; i++)[/code] Look at the red sign carefully. Perhaps you mean this? [code] for(int i = 0; i [COLOR="Red"]<[/COLOR] NUM_IN_TEAM; i++)[/code]

Member Avatar for mcriscolo
0
128
Member Avatar for Nick Evan
Member Avatar for AndreRet
2
435
Member Avatar for ziggystarman

This isn't encryption. No private keys are needed at all. Toss them out. All you're doing is XORing things, which means the next XOR with the exact same public key "decrypts" the message: [code] #include <iostream> using namespace std; /*********************************************************** XOR Process for both encryption/decryption processing ***********************************************************/ string XOR_Encryption(string toBeEncrypted, …

Member Avatar for ziggystarman
0
4K
Member Avatar for Ahna

[QUOTE=Ahna;] A friend of mine recently compiled a simple program to roll dice. He explained he can successfully compile it and even make it run in the compiler, but he does not know how to get the game to play as an executable file/or doesn't know how to export it …

Member Avatar for Ahna
0
121
Member Avatar for ivaylo91

Seems like part math problem, part computer science problem. You could brute force it, I suppose (i.e. don't solve it mathematically by deriving an equation ahead of time), or you could figure it out mathematically based on a, b, c, and d, stick some formula involving a, b, c, and …

Member Avatar for ivaylo91
0
2K
Member Avatar for thelostboy

>> also I dont fully see where these would fit in the real world can anyone give me some example? Faster calculation, storing boolean variables in a single bit. Too many to mention. Asa personal example, I'm currently working with a wireless protocol. Memory and bandwidth are extremely tight, so …

Member Avatar for thelostboy
0
146
Member Avatar for folwea

The easiest sort to write is the bubble sort: [url]http://en.wikipedia.org/wiki/Bubble_sort[/url] >> I have [COLOR="Red"]3 ints[/COLOR](int1,int2,int3), each spanning from 5 to 17, now i want to compare int1 and int2 and type out all numbers from lowest to highest([COLOR="red"]5,6,7,8[/COLOR]...), than i want to compare also int2 and int3 and type out …

Member Avatar for mrnutty
0
130
Member Avatar for petmol

[QUOTE=alexchen;]Line 107-110 [CODE]switch(toupper(ch)) { case 'J':// break; case 'N': // break; default: cout << "Write J/N"<<endl; }[/CODE][/QUOTE] alexchen, I know you're trying to help, but please stop and think. This block was perfectly fine before. [code] ch = toupper(ch); if (ch == 'J') restart = true; if (ch == 'N') …

Member Avatar for pranaymahajan
0
141
Member Avatar for stevanity

So what's the question? It looks like a copy and paste of your homework assignment.

Member Avatar for mrnutty
0
101
Member Avatar for globberbob

Stringstreams might be your best bet here. [code] #include <iostream> #include <sstream> using namespace std; int main () { string bigString, stringAfterNumber; int number; bigString = "25 from a car accident"; stringstream ss (bigString, stringstream::in | stringstream::out); ss >> number; getline(ss, stringAfterNumber); cout << number << stringAfterNumber << endl; cin.get(); …

Member Avatar for globberbob
0
119
Member Avatar for jaglever

void wczytaj(void) { std::ifstream infile("input.txt"); input1 a; int i, j; std::vector<input2> b(2); input2 c; string temp; char byleco; double d = 0.0; while(infile) { infile >> a.model; infile >> a.steps; infile >> a.timehorizon; infile >> a.S; infile >> a.u; infile >> a.d; infile >> a.r; infile >> a.noiip; infile.ignore(); for(int …

Member Avatar for VernonDozier
0
223
Member Avatar for sahil1991

>> The best way is to get the original coder to explain it to you. If the code is well written/documented, the coder has already written and documented it so that it can be understood. If you have to ask them, to my mind, that means it wasn't written well …

Member Avatar for sahil1991
0
216
Member Avatar for AmerJamil

>> Declare an integer array of size 10. Only first ten armstrong numbers can be stored in 0-9 indexes of your array , means Initially you have to find out first ten arm strong numbers and then store it in your array Fairly straight-forward. [LIST=1] [*]Declare an integer array of …

Member Avatar for Ancient Dragon
0
166
Member Avatar for petmol

>>I still don't know what to do. You need to write this function: [code] void showMenu() [/code] or you need to remove all traces of it from your program.

Member Avatar for VernonDozier
0
209
Member Avatar for AmerJamil
Member Avatar for Ancient Dragon
0
174
Member Avatar for gregorynoob

[QUOTE=gregorynoob;706728]it's about having a board with 9 numbers, 1-9 obviously. they are organized in a 3*3 matrix. the solved problem looks like: 123 456 789 the problem is, you are given a scrambled matrix, and you have to fix it using 4 possible moves, rotate top left 2*2, top right, …

Member Avatar for frogboy77
0
167
Member Avatar for jlianne18

>>how can i merge the values of the arrays? Merge how? Do you want to take 10 values from the first file and twenty values from the second text file and end up with an array of 30 values where the 20 values of 2.txt are appended to the ten …

Member Avatar for Saith
0
203
Member Avatar for Mr_PoP

Commas won't work here. You want &&. [code] if(actid != 1 && actid != 2 && actid != 3) { cout << "you must enter an integer"; return 0; }[/code] Checks for 1, 2, 3. Add to it for the other digits.

Member Avatar for Mr_PoP
0
146
Member Avatar for Aqua_annie

Code tags won't help this mess. If you're going to do a verbatim copy/paste, you need to at least make sure you copy and paste something legible. Get rid of all the | characters, etc. Why is this a poll? No, what you posted makes no sense. On the other …

Member Avatar for VernonDozier
-1
131
Member Avatar for AndreRet

>> As you may have guessed, I’m not all that concerned with third parties, even advertisers, knowing the age, gender, UDID, and/or the general (or even specific) location of my device’s end-user (that’s me). To worry about such a thing just seems silly. Count me out. If I didn't give …

Member Avatar for AndreRet
0
203
Member Avatar for zidaneez

Can't help much with the code. It looks Microsoft-specific? But I don't see where you're creating separate processes. I see Reader and Writer objects being created, but no separate Reader and Writer processes? Maybe I'm missing something. I'm a little confused as to what you want to do with this …

Member Avatar for VernonDozier
0
1K
Member Avatar for rhum123

I can't read this code. The indentation is all messed up. You should format it. You should also stick some brackets in to make it crystal clear what's inside the for-loop starting on line 27. >> it always making some error report. What's the error message? You should provide it. …

Member Avatar for programmersbook
0
174
Member Avatar for alexchen

Seems like deja vu. I thought this problem was already fixed. [url]http://www.daniweb.com/forums/thread333415-2.html[/url] Line 56 - Even if index is properly calculated, what is the purpose of this while loop?

Member Avatar for alexchen
0
109
Member Avatar for chrisbrandon

I disagree. Questioners need accurate answers, particularly beginners. This forum and all the others are flooded with inaccurate answers that often never get corrected with the proper advice. Hence when you do a google search on a topic you don't know, you often have to wade through several pages of …

Member Avatar for diafol
0
131
Member Avatar for alexchen

The formatting makes the code almost impossible to read, at least for me. Line 54 - Are you intentionally using commas or are those supposed to be semicolons? Could be OK, but looks a bit suspicious. I'm more than a bit rusty on commas and comma operators, if I ever …

Member Avatar for alexchen
0
333
Member Avatar for VernonDozier

I have a project with a bunch of different options that you can turn on and off sprinkled throughout many files. You comment and uncomment the options you want, much like the php.ini file in PHP file, though this is actual code. It looks something like this: [code] //#ifndef _OPTION_1 …

Member Avatar for VernonDozier
0
174
Member Avatar for samaitaben

[QUOTE=samaitaben;632374]Can any one please assist with code for two objects coming from different direction. Subsequently, collide after intersection. The objects should be moving at 80km/h. And collision should happen shortly 30 minutes after take off[/QUOTE] That's a program with many parts. You need to provide much more information. Is this …

Member Avatar for tamiruu
0
285
Member Avatar for dynamyt3

If you are trying to implement arkoenig's method, as I understand it, since you have 12 numbers, you would want to make sure you generate random index(es) exactly 12 minus 1 = 11 times. That means you should be calling rand() from inside a loop. Make sure your code does …

Member Avatar for dynamyt3
0
1K

The End.