2,827 Posted Topics

Member Avatar for jimJohnson

[QUOTE=jimJohnson;1212078]I am doing a homework assignment for CSI 330 and not sure how to begin this program. It is asking me to initialize and unsigned int variable mask, with a value whose binary representation has a 1 followed by all 0's. The second part says... For a counter running from …

Member Avatar for VernonDozier
0
88
Member Avatar for dusktreader

Post it as a link or an attachments rather than the code in the post, I'd say. That way anyone who wants to try it on their own before looking at yours can do so. I have one that I created a year and a half ago. But I think …

Member Avatar for dusktreader
0
439
Member Avatar for nola_Coder

[QUOTE=nola_Coder;1210006]I want to implement a countdown timer in a game, but need some help figuring out how to do it properly. I know that this is probably a very regular question that has been asked a thousand times, but I've been trying out some methods I found through searching, but …

Member Avatar for VernonDozier
0
155
Member Avatar for bigt666

Use code tags and formatting. [noparse] [code] // code here [/code] [/noparse] [code] #include <iostream> #include <fstream> using namespace std; void ReadList(int Array[ ], int N) { N = 0; ifstream input("file.txt"); Array [ return; } void Avgs (int Array[], int N, int& Ave, int& aveP, int& AveN) { return; …

Member Avatar for VernonDozier
0
109
Member Avatar for Chrisjj

[QUOTE=Chrisjj;1200557] infraction noun, formal [COLOR="Red"]the breaking of a[/COLOR] law, [COLOR="Red"]rule[/COLOR], etc; [COLOR="red"]violation[/COLOR].[/QUOTE] Seems like the word matches the definition to me. What's your point?

Member Avatar for diafol
0
783
Member Avatar for Lukezzz

[QUOTE=Lukezzz;1209656]Hi, I have a question about when you have compliled a Form application as a release where the product exists of: - exe.file - Program Debug Database - Incremental Linker File What I now wonder is that I have in my project some important usernames and passwords. My question is …

Member Avatar for VernonDozier
0
100
Member Avatar for Instinctlol

I don't see the clearing of cin in your code. Here's a full program using Narue's code. Upon failure, you need to clear it and throw away the bad characters. [code] #include <iostream> using namespace std; int main () { int number = 0; // anything but -1. while (number …

Member Avatar for VernonDozier
0
81
Member Avatar for RayRay1

[QUOTE=RayRay1;1206957]I think that I have too much extra in this code. I'm trying to figure out a way to eliminate some of the functions that I might not need. Basically what I need to do is implement a polynomial that has rational coefficients. I have created two separate codes; one …

Member Avatar for Lerner
0
679
Member Avatar for jbl09

You only need one thread. [url]http://www.daniweb.com/forums/thread280261.html[/url]

Member Avatar for caut_baia
0
243
Member Avatar for tennis

[QUOTE=tennis;1206972]Yes, there are different ways to write the program, I am just testing this version of code. I am not asking for alternatives. What I don't understand is why there is a run-time error if I omit the following 2 lines, x=new int; y=new int; Also why I get a …

Member Avatar for VernonDozier
0
126
Member Avatar for ahmed.123

Here is your code, formatted. It's much easier to read. Perhaps you are mixing spaces and tabs? Don't. It will look terrible on Daniweb if you do. [code] #include <iostream> #include <fstream> // Header to use input and output #include <string> using namespace std; void main() { ifstream ifile; // …

Member Avatar for VernonDozier
0
108
Member Avatar for jbl09

[code] while (inFile){ for (n = 0; n < 7; n++){ inFile >> truckWeight; } [/code] You're losing all your data here. You read in about 100 numbers and overwrite the last number each time. Seems to me that truckWeight should be a two dimensional array since you have a …

Member Avatar for peter_budo
0
274
Member Avatar for ironstove

A few options for 2-dimensional arrays. [LIST=1] [*]Static allocation. [*]Dynamic allocation. [/LIST] Static allocation is when you know the size of the array beforehand, as you do. You know in advance that the matrix will be a 5 x 5 matrix. So you are in the first category (static). That's …

Member Avatar for VernonDozier
0
215
Member Avatar for Twonk

You need to track down where your error occurs. It can be in one or more of at least three places: [LIST=1] [*]Bad parameters passed to the constructor on line 196. Display the parameters before the call. If they are incorrect, debug prior to line 196. [*]Good parameters passed to …

Member Avatar for VernonDozier
0
416
Member Avatar for e30rapidic

Is the class named Rational or is the class named RationalNumber or are there two classes? If there is no class called Rational and you have anything that looks like [ICODE]Rational::[/ICODE], the compiler/linker has no idea that it is supposed to be a class and will thus try to find …

Member Avatar for VernonDozier
0
2K
Member Avatar for obeem

Without seeing the driver program it's hard to tell, but the design seems flawed. These functions shouldn't take the char[] parameter since they are member functions. Your char[] array is thus passed with the object, so you don't need it as a parameter. Thus I would imagine you would want …

Member Avatar for obeem
0
120
Member Avatar for Uni616

Everything you posted looks portable from Windows to Linux and vice-versa, so I would imagine the problem would be elsewhere, either in code you haven't posted or some linking or compiler or makefile issues. I'd try building it with g++ on Windows outside of the IDE using whatever Makefile you …

Member Avatar for VernonDozier
0
115
Member Avatar for fugnut

Break it into pieces and you'll quickly find the exact offending line: [code] infile >> employee[ idx].id; infile >> employee[ idx].name; infile >> employee[idx].pay_rate; infile >> employee[idx].dependants; infile >> employee[idx].pt; // this line [/code] You'll need to write a >> operator for your PayType enum. What is the appropriate input …

Member Avatar for Fbody
0
131
Member Avatar for i_luv_c++

[QUOTE=i_luv_c++;1205354]hey guys im new to recursion to recursion..pls look at the function call ...question is how do i call in two functions at the same time..and which one should i return thank you. [/quote] This code cannot return false. You need at least one line that says "return true" and …

Member Avatar for i_luv_c++
0
262
Member Avatar for Justin9825

calcIns is a FUNCTION, not a VALUE in your program. You have no variable called calcIns. I assume you want to display the results of a CALL to the function, not the function itself. In that case, you need to call calcIns and assign a variable to equal the return …

Member Avatar for Justin9825
0
208
Member Avatar for davronrshkent

We can't help you as you have not provided file list_reversal.cpp. You need to make an attempt and post here with a specific question when you get stumped. You've simply copied and pasted the assignment verbatim. That's going to get you no help. Give it a shot first and post …

Member Avatar for VernonDozier
0
92
Member Avatar for SacredFootball

The whole beauty of vectors is that you don't have to handle any of the memory management. All the sizing and resizing is done for you when you add and remove elements. Thus they are PERFECT for unknown sizes. I'm sure there's a bunch of malloc, calloc, and realloc calls, …

Member Avatar for VernonDozier
0
134
Member Avatar for marcoakis

Visual C++ Format option to the rescue, plus changing all tabs to 4 spaces. On Daniweb, a tab is 8 spaces, so if you mix tabs and spaces it looks terrible. [code] // DelgadoMarcoA1.cpp // Written by Marco Delgado // Data finished: May 6th 2010 // Program description: #include <iostream> …

Member Avatar for VernonDozier
0
146
Member Avatar for RayRay1

First thing that you need to do is write a driver program that has a main function in order to test it. Test the constructors and printRational. If you haven't written printRational, write it because you'll need it a lot when testing. [code] // driver program // includes int main …

Member Avatar for RayRay1
0
846
Member Avatar for john10

[QUOTE=john10;1200552]Thanks for this, didn't notice the post till after I completed my result. I'll try it out thanks. Edit: I tried it, problem with it is that it displays the canvas twice, i think it's preferred to be just displayed once.[/QUOTE] So this is a sine-wave plotted against time? Since …

Member Avatar for VernonDozier
0
179
Member Avatar for Joonhwa Yang

This isn't a code snippet. It's a regular thread. [code] getData(dataFile, data[], count); [/code] Function calls shouldn't have the [] in them. Function prototypes do, but not function calls. Delete the [] in the function call and try recompiling.

Member Avatar for thousandpimps
0
4K
Member Avatar for lllllIllIlllI

Well, I've never heard an American say that Australians say ""You beauty mate", so I won't say you're wrong, I'm just puzzled. Hadn't realized that Aussies stereotyped us as stereotyping them that way. There's nothing different about McDonald's here than anywhere else in the world. I don't think anything's bigger …

Member Avatar for lllllIllIlllI
0
718
Member Avatar for hurricane123

[QUOTE=hurricane123;1198195]is there any difficulties of sorting parallel arrays?if there then what are those[/QUOTE] Are you still here? You'd think that after being caught in straight-up plagiarism you would have left. [url]http://www.daniweb.com/forums/thread269344.html[/url] Really, don't make it so obvious that you are completely unwilling to put any effort into anything.

Member Avatar for VernonDozier
-3
219
Member Avatar for diafol

[QUOTE=ardav;1150525]Is it me or are there loads of members reanimating long-expired threads? Is there a way to automatically close threads say a certain amount of time after the last post? Being faced with 2 year old posts cluttering up my favourite forum is seriously annoying me. If the posters had …

Member Avatar for diafol
1
717
Member Avatar for timbomo

Fix the code tags. Replace all tabs with 4 spaces. Repost, but preview first. Look at the link Walt P posted. [noparse] [code] // code here [/code] [/noparse] Embedded code tags don't work. Preview before posting!

Member Avatar for VernonDozier
0
137
Member Avatar for timbomo

Write a program that opens and closes one of the files that isn't working and does nothing else. See if that works. If THAT works and the full program doesn't, compare the code. If the code is the same, then make sure you aren't: [LIST=1] [*]Deleting the file mid-program. [*]Opening …

Member Avatar for timbomo
0
122
Member Avatar for VernonDozier

You see an orange or green dot and are curious. Who gave it and why? Currently you can't find out without giving some rep yourself. I propose a "Cancel" button after you view the rep. Sometimes you don't want to weigh in. You just want to view the comments.

Member Avatar for VernonDozier
0
101
Member Avatar for smackdown164

Close on the code tags. You forgot an opening bracket. [noparse] [code] // code here [/code] [/noparse] What error messages do you get, and what are the corresponding line numbers?

Member Avatar for lakarr
0
616
Member Avatar for Hidden_mistakes

[QUOTE=Hidden_mistakes;1194951]I am trying to write a racing game but i need some winning conditions. Im not sure where to start, any pointers would help. Im using Visual C++[/QUOTE] Start by explaining what you mean by "winning conditions" and what exactly the program is supposed to do.

Member Avatar for VernonDozier
0
129
Member Avatar for zandiago

Anyone who has ever been around a high school where there has just been a car accident that killed a bunch of high school students there will notice that they are far more stunned by the fact that someone their age can actually die than, say, a bunch of 25-year-olds …

Member Avatar for BestJewSinceJC
0
86
Member Avatar for Hatem Faheem

I have a few code snippets that might be of interest. I've been meaning to post some more or at least post some diagrams that explain the algorithm a little bit, but I haven't gotten around to it. [url]http://www.daniweb.com/forums/search5523578.html[/url]

Member Avatar for VernonDozier
0
115
Member Avatar for sah15

In addition, consider the overall design. Do you want to use integers as the values of the sides? I would use doubles. Be wary of comparing doubles using the == operator as you do in [ICODE]isRight ()[/ICODE]. There's a potential for round-off error. Since you are typecasting from integers and …

Member Avatar for Ancient Dragon
0
1K
Member Avatar for zandiago

As long as it's a reasonable formula. A big (and completely legiimate) beef by teachers at schools in lower socio-economic schools is that they can hardly expect to compete with schools in rich areas performance-wise since they have a whole bunch of problems that the schools in rich areas don't …

Member Avatar for diafol
2
382
Member Avatar for VernonDozier

Hopefully this is fairly basic. I've never used enumerated types in Java. I'm sort of trying to take my C concept of them and make it work in Java. Basically use them as constant integer values. That might be putting the square C block into the round Java hole. I'm …

Member Avatar for VernonDozier
0
145
Member Avatar for angrycoder

I am looking for something in the code somewhere along the lines of: [code] if (/* node is found */) { // increment node.frequency }[/code] I see nowhere where[ICODE] frequency[/ICODE] is used at all. Your insertion process should be something like this: [LIST=1] [*]Search the tree for a word. [*]If …

Member Avatar for Lerner
0
158
Member Avatar for vmirz

[QUOTE=vmirz;1186210]My goal is to implement a sorting into a linked list. I have everything working thus far, but I'm a bit stumped as to how I need to change my insert function in order for an element to be placed in the appropriate location. [/QUOTE] First you have to have …

Member Avatar for VernonDozier
0
143
Member Avatar for jeffrey o

Code tags: [noparse] [code] // put code here [/code] [/noparse] Please edit your post and put the code tags in. It's easier to read.

Member Avatar for WaltP
0
112
Member Avatar for cwarn23

[QUOTE=jephthah;1163914] But I have yet to see [B]any [/B]time anyone [B]ever [/B]contributed anything remotely meaningful to a thread that has been dead for more than three months. [/QUOTE] [URL="http://www.daniweb.com/forums/thread90228.html"] Exhibit A[/URL] Some bumps are worth reading.

Member Avatar for WaltP
0
355
Member Avatar for samrin

Reposted with code tags: [noparse] [code=JAVA] // code] [/code] or [code] // code] [/code] [/noparse] [code] 3 Sample output * *** ***** *** * [/code] [code=JAVA] public class p2.java{ public static void main (String args[]){ int x; SimpleInput sInp = new SimpleInput(); x = sInp.getInt("please enter an Integer"); int y …

Member Avatar for javaAddict
0
171
Member Avatar for sm4ckth3monkey

Lines 43 and 44 don't make sense: [code] if(root == NULL) root[i][j] = new node(a); [/code] This would make more sense: [code] if(root != NULL) root[i][j] = new node(a); [/code] The whole point of checking for NULL is so that you don't dereference a NULL pointer. You're checking to make …

Member Avatar for VernonDozier
0
1K
Member Avatar for timbomo

[QUOTE=timbomo;1176408] //function that rolls dice. IT DOESNT ROLL I GUESS YOU CAN SAY. I WAS THINKING OF PUTTING THIS IN A SWITCH STATEMENT BUT HAVING PROBLEMS WITH GENERATING RANDOM NUMBER [CODE]int if_roll() { int which_Num; unsigned seed = time(0); srand(seed); which_Num = rand() % 7; return which_Num; }[/CODE] [/quote] You …

Member Avatar for timbomo
-1
118
Member Avatar for pinknblu

[QUOTE=pinknblu;1165669]Thank-you, I figured that much....will continue to work on it...later. If anyone else has input..it would be appreciated.[/QUOTE] Code tags. [noparse] [code] // code here [/code] [/noparse] Take the errors one by one. Some are obvious: [code] int line (char *p) [/code] What's this? [code] cin.getline() [/code] Where does the …

Member Avatar for pinknblu
0
138
Member Avatar for MTW1989

This is the same issue as your other thread. [url]http://www.daniweb.com/forums/thread270830.html[/url] I explained what the problem was there. You are using uninitialized variables. I suggested back then that you initialize your arrays to something like -999999 so the lack of initialization will stand out. You can't use uninitialized variables in calculations …

Member Avatar for venkat arun
0
118
Member Avatar for VernonDozier

I have some code that works. However, when I try to make it not work (i.e. try to execute a non-existent program), I don't see any indication that it hasn't worked. Here's the code snippet. [code=C] pid_t pid; // char *const paramList[] = {"/usr/threshold/bin/preconfig.sh", options[indexSelected].optionName, NULL}; const char* paramList[] = …

Member Avatar for VernonDozier
0
7K
Member Avatar for Xlphos

Yup, you have thirty minutes and that's it, then whatever diatribe, venting, extremely bad coding help, etc., is set in stone for eternity, public for all the world to see. You have thirty minutes, and that assumes no one has REPLIED to your post (hence putting YOUR post in THEIR …

Member Avatar for Nick Evan
0
213

The End.