2,712 Posted Topics

Member Avatar for lllllIllIlllI

Go out with friends. Go to a dinner and movies with friends or go girl hunting, ahem. Then come back home to your families, and have a birthday cake celebration. Happy late, b-day. May the light be with you.

Member Avatar for William Hemsworth
7
135
Member Avatar for fada4ever

>>const double PI=2.0 * asin(1.0); Just Do : const double PI = 3.14159265; no reason for the call to asin. >>include a derive class named sphere from the base circle class. Means : [code] class Sphere : public Circle { } [/code] >>class cylinder : public sphere Make no sense.

Member Avatar for mrnutty
0
172
Member Avatar for Neon87

[QUOTE]if A goes out of scope does this mean the pointer B is a bad pointer meaning it does not point to anywhere? [/QUOTE] Yes, A goes out of scope and its destructor is called. You should really have B in the same scope as A. That means B shouldn't …

Member Avatar for Narue
0
101
Member Avatar for evolution120

[QUOTE=evolution120;1077636]Hi there, im new to c programming, just wanted to know is it possible to do a simple if else for 1 username login for C programming? thanks. [/QUOTE] Sure : [code] //declare char *password = "hello"; //ask user for the password //check if( strcmp(userInput,password) == 0 ) //if so …

Member Avatar for mrnutty
0
74
Member Avatar for Stefano Mtangoo

1. What is your favorite IDE Microsoft visual studio. just tried eclipse, and its not bad either. Both debugger are nice. 2. What is your favorite GUI library OpenGL, the only one I use. 3. What is library that you often use? STL's.

Member Avatar for Lawand
0
139
Member Avatar for nychick
Member Avatar for jonsca
0
89
Member Avatar for Stefano Mtangoo

Virtual functions and polymorphism are closely related. A virtual function means that a some class with a virtual function will be derived from, and that virtual function will be overridden by the derived class. To declare a virtual function the syntax is : [code] class VirtualBase{ public : virtual void …

Member Avatar for Stefano Mtangoo
0
654
Member Avatar for DevC++4.9.9.2

change : [code] int mod(int &num, int &num2) [/code] to [code] int mod(int num, int num2) [/code] So it works with the copy of num1 and num2 and not it indirectly.

Member Avatar for r.stiltskin
0
125
Member Avatar for BigTito89
Member Avatar for girl.java
Member Avatar for confusedndazed

[code]#include <iostream> using namespace std ; void displayTitle () { cout << "Active Duty Navy personnel Program" << endl ; } int main () { displayTitle () ; int Age[50] ; // age of personnel int I ; // number of ages entered int sum ; // sum of ages …

Member Avatar for confusedndazed
0
102
Member Avatar for pac-man

>>output("1", "k"); // ? should be a string : [code] output(string("1"), string("k")); // ? [/code] Whats happening is that "1" and "k" is being interpreted as a const char*

Member Avatar for mrnutty
0
112
Member Avatar for kumaran21

>>Is this what is required to create an object in Java? Yes, you have to instantiate every object in java. >>What do they mean when they say handPhone type? Its a data type just like a int is a data_type handPhone is a data_type. It just has different capabilities and …

Member Avatar for Perveance
0
317
Member Avatar for Snippset

>>I need to check if two provided words doesn't have the same letter in it By that you mean if two strings are not equal to each other. Is this case sensitive? If so then using tolower would be a good idea( or toupper). Can you use std::strings , instead …

Member Avatar for Snippset
0
170
Member Avatar for naej

[QUOTE=rstdnm;1076421]haha. cool. same here, I'm trying to make a snake game too. i cant get the snake to move without me having to press the buttons again and again. getch, switch, scanf and everything waits for the user to press a key... so, how do we make a snake game?[/QUOTE] …

Member Avatar for mrnutty
-1
70
Member Avatar for Cy137

>>I keep receiving the same output for each record when I run it on the test data. I've tried numerous things...any suggestions? Yes, learn how to use the debugger! You can't just dump "huge" code on us and expect us to fix it for you. If you "step-by" your code, …

Member Avatar for mrnutty
0
189
Member Avatar for sidra 100
Member Avatar for mrnutty
0
64
Member Avatar for pmee

<quote>So basically I want to be able to stick a few zeros in front of the smaller binary numbers. Check the length, while(binary.length mode eight != 0 ) addToFront('0');

Member Avatar for iAmLast
0
979
Member Avatar for Instinctlol

That usually means that your variable contains junk and you haven't initialized it to anything. I am guessing its a double variable somewhere in your program. [quote]9.222255e+061[/quote] Approximately it also means -9.2 * 10^61

Member Avatar for stephen.id
0
89
Member Avatar for PDB1982

Your highest function should return an INT, and that int should be the index of the highest element in that array. Change that first. Next, your highest function is almost correct, except that your max should be the index to the highest value, and your if statement should check every …

Member Avatar for mrnutty
0
164
Member Avatar for jwxie

C++ is like a girl, make one mistake and it will kill you. Debugging C++ code is like trying to figure out a girl, its almost impossible.

Member Avatar for MosaicFuneral
0
61
Member Avatar for tango2009

try something like this : [code] char *Index[2] = { "Index of first(", "Index of second(" }; //and so on int cntr = 0; while(start != end) //start and end are the beginning and the end iterator of a container { cout << Index[cntr] << *start <<")"<<endl; start++; } [/code]

Member Avatar for pac-man
0
102
Member Avatar for nedsnurb

You cannot initialize the member variables inside the class: [code] //WRONG int n = 0; int* ArrayOne = NULL; //CORRECT int n; int *ArrayOne; public : classConstructor(int _n, int Size) { n = _n; ArrayOne = new int[Size]; } [/code] Get that done first.

Member Avatar for mrnutty
0
2K
Member Avatar for abhaymv

Test all cases if you can. If not then test the extrema. Then test randomly. More test the better.

Member Avatar for mrnutty
0
61
Member Avatar for bhey

These variable are used for numbers : [code]int word, a, perfume;[/code] What you need to use is something that can handle words, like std::string; [code] string word, a, perfume; [/code] Also I notice that "a" variable, is the correct word that you are trying to compare in this statement : …

Member Avatar for bhey
0
204
Member Avatar for Sheltac

This part : [code] for(int index = 0; index < dim; index++){ aux = matrix[i][index]; matrix[i][index] = matrix[j][index]; matrix[j][index] = aux; } [/code] What do you think its doing? Were you trying to swap ?

Member Avatar for Sheltac
0
172
Member Avatar for ayan2587
Member Avatar for jonsca
0
113
Member Avatar for mrnutty

[URL="http://thread.gmane.org/gmane.comp.version-control.git/57643/focus=57918"] O M G[/URL]

Member Avatar for ddanbe
0
246
Member Avatar for jitu44

[QUOTE=jitu44;1075082]How can find the repitition of a number from a given array with less time complexity(<N)?[/QUOTE] You need to check through every element in the array to ensure that there is no repetition right ? So if the array was of size n, then to ensure that there is no …

Member Avatar for mrnutty
0
77
Member Avatar for alflash

can't you just use a function : [code] int generateGameID(){ static int i = 0; ++i; return i; } [/code] And use that inside you game : [code] do{ int currId = generateGameID(); while(gameIsNotOver){ runGame(currId) } }while( someCondition ); [/code] Or did I misread your post?

Member Avatar for jonsca
0
78
Member Avatar for Spiderpig085

[QUOTE=Spiderpig085;1068977]is there any way to prevent this???[/QUOTE] Yes there is, probably.

Member Avatar for Spiderpig085
0
141
Member Avatar for Snapster5

The cmath library already has the power function so you don't have to create a function. Plus your syntax is horrible. You got the idea correct but not the logic and the syntax. This is what you should be doing [code] #include<iostream> #include<cmath> using namespace std; int main() { float …

Member Avatar for Ancient Dragon
0
149
Member Avatar for tomtetlaw

How about using strings to represents float, char, double, int, and so on. [code] string Types[4] = { "124","1.234","aString","c" };[/code] Then you can convert it accordingly with sstream.

Member Avatar for mrnutty
0
1K
Member Avatar for StaticX
Member Avatar for new programer

[code] const int REPEAT_CODE = 666; int userInput = 666; //could be any value for now do{ runGame(); getInput(); }while(REPEAT_CODE == userInput); [/code]

Member Avatar for mrnutty
0
93
Member Avatar for dvdreplication

Summer. Because there is no school. Just eat, sleep, and poop, among other things.

Member Avatar for characteredu
-4
131
Member Avatar for rafta

I thought you knew what you were doing until I seen this : [code] if (data[i].Points>highest) { //save this value highest= data[i].Points; //save this player number and Name highest=data[i].Name; } [/code] What are you trying to achieve here? Explain, so I can see what you are thinking.

Member Avatar for rafta
0
153
Member Avatar for jdrei

First your temp variable is not initialized but you use it. Second check [URL="http://www.daniweb.com/code/snippet238610.html"] this [/URL]and see if it help, look particularly at the logic inside the loop. Third you have the x declared before the for loop and inside it. So that might be your problem. Doing this works …

Member Avatar for jdrei
0
86
Member Avatar for hassedo

Wow over 500 lines for a determinant. Maybe you should be a teacher? Seriously, I wouldn't want use that function to calculate the determinate, becuase I would have to do this : compute(matrixVar,var1,var2,matrixVar,a,b,c,d,e,f,g ..........); Do you think that pleasent? As for your question, try print out the result at certain …

Member Avatar for Dave Sinkula
-1
83
Member Avatar for PDB1982

This part is wrong : [code] inF >> id; while (!inF.eof()) { cnt++; myStuds[cnt].id = id; myStuds[cnt].fname = fname; myStuds[cnt].lname = lname; for (int i = 1; i < 5; i++) inF >> myStuds[cnt].gr[i]; myStuds[cnt].avg = 0.0; myStuds[cnt].letGr = 'Y'; inF >> id; } [/code] I assume you wan't something …

Member Avatar for Dave Sinkula
0
90
Member Avatar for whitetigerx8

Try degubbing it. Print out everything in the map before and after you make that search call.

Member Avatar for whitetigerx8
0
101
Member Avatar for merse

Well there are also other ways. Here is a another way : [code] #include<iostream> using namespace std; template<typename Type> struct assert_numeric{ const static int i = 0; }; template<> struct assert_numeric<short> { const static int i = 1; }; template<> struct assert_numeric<unsigned short> { const static int i = 1; …

Member Avatar for merse
0
141
Member Avatar for n3r3d

Can you use [URL="http://www.cplusplus.com/reference/algorithm/remove_if/"]remove_if [/URL]?

Member Avatar for n3r3d
0
195
Member Avatar for MattyRobot
Member Avatar for amsmith90

Don't use define. Use this : [code] const unsigned int MAX_SIZE = 6; int main(){ ... } [/code] For sorting and searching use the stl sort and find method. So to start have this : [code] #include<iostream> #include<algorithm> //for search and sort methods using namespace std; int menu(); //returns a …

Member Avatar for Nick Evan
0
75
Member Avatar for merse

In C++ term of reference or in general ? You can do this : [code] Complex& Complex::getClass() { return *this; } [/code] That way, you get the Complex class as a reference in terms of the reference operator.

Member Avatar for merse
0
67
Member Avatar for Seriss

>>. I also have to get these 2 classes to communicate somehow so it can use the hours from array2 and the pay from array1 to come up with a total pay amount. >>I just don't know how to make the 2 classes communicate. There are couple of ways. But …

Member Avatar for Seriss
0
86
Member Avatar for IT seeker

Go to youtube and learn about functions from professors. Youtube has many good programming videos. try it out.

Member Avatar for mrnutty
-1
63
Member Avatar for xavier666

>>But this looks ugly and I had to use a separate variable. I think that looks beautiful. In fact you can just make a function that does that, and so it will be in a sense a one liner. I don't think there is a standard implementation of getch in …

Member Avatar for xavier666
0
155
Member Avatar for endofworld201

[QUOTE=niek_e;1071072]Thread split from ancient thread, moved and given an appropriate title :) @OP: You need to [URL="http://www.daniweb.com/forums/announcement8-2.html"]read this[/URL][/QUOTE] aww man. I though some n00b came up with this title. I should have known. This is funny though.

Member Avatar for xavier666
-1
105

The End.