2,712 Posted Topics
Re: 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. | |
Re: >>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. | |
Re: [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 … | |
Re: [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 … | |
Re: 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. | |
Re: Is there a particular problem? For you operator >, you can just do : return !(a < b ); | |
Re: 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 … | |
Re: 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. ![]() | |
Re: [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 … | |
Re: >>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* | |
Re: >>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 … | |
Re: >>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 … | |
Re: [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] … | |
Re: >>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, … | |
Re: <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'); | |
Re: 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 ![]() | |
Re: 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 … | |
Re: 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. | |
Re: 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] | |
Re: 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. | |
Re: Test all cases if you can. If not then test the extrema. Then test randomly. More test the better. | |
Re: 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 : … | |
Re: 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 ? | |
Re: So do you know how to create a regular 1d array of size n, dynamically? | |
[URL="http://thread.gmane.org/gmane.comp.version-control.git/57643/focus=57918"] O M G[/URL] | |
Re: [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 … | |
Re: 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? | |
Re: [QUOTE=Spiderpig085;1068977]is there any way to prevent this???[/QUOTE] Yes there is, probably. | |
Re: 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 … | |
Re: 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. | |
Re: Is it in the same directory? Show some code? | |
Re: [code] const int REPEAT_CODE = 666; int userInput = 666; //could be any value for now do{ runGame(); getInput(); }while(REPEAT_CODE == userInput); [/code] | |
Re: Summer. Because there is no school. Just eat, sleep, and poop, among other things. | |
Re: 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. | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: Try degubbing it. Print out everything in the map before and after you make that search call. | |
Re: 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; … | |
Re: Can you use [URL="http://www.cplusplus.com/reference/algorithm/remove_if/"]remove_if [/URL]? | |
Re: 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 … | |
Re: 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. | |
Re: >>. 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 … | |
Re: Go to youtube and learn about functions from professors. Youtube has many good programming videos. try it out. | |
Re: >>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 … | |
Re: [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. |
The End.