Search Results

Search found 33 results on 2 pages for 'sil3nt'.

Page 1/2 | 1 2  | Next Page >

  • Time based movement Vs Frame rate based movement?

    - by sil3nt
    Hello there, I'm new to Game programmming and SDL, and I have been following Lazyfoo's SDL tutorials. My question is related to time based motion and frame rate based motion, basically which is better or appropriate depending on situations?. Could you give me an example where each of these methods are used?. Another question I have is that, in lazyfoo's two Motion tutorials (FPS based and time based) The time based method showed a much smoother animation while the Frame rate based one was a little hiccupy, meaning you could clearly see the gap between the previous location of the dot and its current position when you compare the two programs. As beginner which method should I stick to?(all I want is smooth animations).

    Read the article

  • D-Link DWA-125 constantly disconnecting in winXP, but works fine on ubuntu..

    - by sil3nt
    Hey there, I'm dual booting winXp and ubuntu 10.10. I'm using a DWA-125 usb adapter to connect to my home wifi connection and I'm having this odd issue. First off, in ubuntu the adapter works fine and I have no trouble at all, but when I boot back in XP I get a dlink connetion wizard and the connection times out after every 2 minutes. It's odd because I can actually load up web pages and use the internet for 2 minutes, and then it would disconnect and the whole thing would repeat. I did a system restore on xp and this stopped the whole connect-disconnect thing but once I booted into ubuntu and came back to xp it started all over again!(?). Any ideas as to how I would go about fixing this?

    Read the article

  • Should I buy this particular MacMini?

    - by sil3nt
    Hello there, I'm not certain if this is the forum I should post this in but here goes anyway. So, I'm honestly clueless when it comes to mac's and I've never owned one before, in fact I still don't own anything with "i" in front of it (not a pc fan, but just low on cash you see:) and I was wondering if these specs are adequate? it's a MacMini G4 1.42Ghz, 1GB ram, 80Gb HDD, 32mb gfx The reason I'm looking for a mac is to start out in some iphone development, and I want a system that wont hang. would this particular system be suitable?. I just need it to be usable and not lag.

    Read the article

  • printing in the same line in java.

    - by sil3nt
    Hi there, I have a base class called Items and 3 derived classes, and within the Items base class i have a print function of the form public void print(){ System.out.println("ID " + id + " Title " + title + " <" + year + "> "); } and within every derived class I call the Items print function through super.print(); which is followed by a specific print function relating to the derived class. My problem is, whenever the printing is executed from one of the derived classes the printed text is not on the same line. So super.print() will be in the line above the derived class print function. How do I get them both to be on the same line?

    Read the article

  • Please Help Me with my Homework Problem in C++

    - by sil3nt
    Hey there, this is part of a question i got in class, im at the final stretch but this has become a major problem. In it im given a certain value which is called the "gold value" and it is 40.5, this value changes in input. and i have these constants const int RUBIES_PER_DIAMOND = 5; // relative values. * const int EMERALDS_PER_RUBY = 2; const int GOLDS_PER_EMERALDS = 5; const int SILVERS_PER_GOLD = 4; const int COPPERS_PER_SILVER = 5; const int DIAMOND_VALUE = 50; // gold values. * const int RUBY_VALUE = 10; const int EMERALD_VALUE = 5; const float SILVER_VALUE = 0.25; const float COPPER_VALUE = 0.05; which means that basically for every diamond there are 5 rubies, and for every ruby there are 2 emeralds. So on and so forth. and the "gold value" for every diamond for example is 50 (diamond value = 50) this is how much one diamond is worth in golds. my problem is converting 40.5 into these diamonds and ruby values. I know the answer is 4rubies and 2silvers but how do i write the algorithm for this so that it gives the best estimate for every goldvalue that comes along??

    Read the article

  • going reverse in a for loop?

    - by sil3nt
    Hello there, Basically i got this for loop and i want the number inputed (eg. 123) to be printed out in reverse, so "321". so far it works fine and prints out the correct order when the for loop is for(i = 0; i<len ; i++) but i get an error when i try to print it in reverse?. Whats going wrong? #include <stdio.h> #include <string.h> void cnvrter(char *number); int main(){ char number[80]; printf("enter a number "); gets(number); cnvrter(number); return 0; } void cnvrter(char *number){ char tmp[80]; int i = 0,len = 0; int cnvrtd_digit = 0; len = strlen(number); printf("\nsize of input %d\n",len); for(i = len; i>len ; i--){ if ( ( number[i] >= '0' ) && ( number[i]<='9' ) ){ tmp[0] = number[i]; sscanf(tmp,"%d",&cnvrtd_digit); } printf("%d\n",cnvrtd_digit); } }

    Read the article

  • Quick question on using the constructer with multiple files.

    - by sil3nt
    Hi there, I have this class header //header for class. #ifndef Container_H #define Container_H #include <iostream> using namespace std; const int DEFAULT=32; class Container{ public: Container(int maxCapacity = DEFAULT); ~Container(); void insert(int item, int index); void erase(int index); int size()const; private: int sizeC; int capacityC; int * elements; }; void info(); #endif and this source file #include "container.h" Container::Container(int maxCapacity = DEFAULT){ int y; } void Container::insert(int item, int index){ int x; } and when i compile this i get the following error message test.cpp:4: error: default argument given for parameter 1 of `Container::Container(int)' container.h:12: error: after previous specification in `Container::Container(int) what have i done wrong here?

    Read the article

  • scite editor and gcc setting up?.

    - by sil3nt
    Hey there, In class we're using the Scite editor with gcc and its a tad outdated. I was wondering how you would "attach"(For lack of a better term) gcc to scite so that it would compile the code when I hit the compile icon?. Also would this process be the same when using other text editors like notepad++. -cheers.

    Read the article

  • adding a node to a linked list.

    - by sil3nt
    Hi there, ive been given the following code, And im just wondering, what does *&listpointer mean in the argument of the addnode function? struct Node { int accnumber; float balance; Node *next; }; Node *A, *B; int main() { A = NULL; B = NULL; AddNode(A, 123, 99.87); AddNode(B, 789, 52.64); } void AddNode(Node * & listpointer, int a, float b) { // add a new node to the FRONT of the list Node *temp; temp = new Node; temp->accnumber = a; temp->balance = b; temp->next = listpointer; listpointer = temp; }

    Read the article

  • friendship and operator overloading help

    - by sil3nt
    hello there, I have the following class #ifndef Container_H #define Container_H #include <iostream> using namespace std; class Container{ friend bool operator==(const Container &rhs,const Container &lhs); public: void display(ostream & out) const; private: int sizeC; // size of Container int capacityC; // capacity of dynamic array int * elements; // pntr to dynamic array }; ostream & operator<< (ostream & out, const Container & aCont); #endif and this source file #include "container.h" /*----------------------------********************************************* note: to test whether capacityC and sizeC are equal, must i add 1 to sizeC? seeing as sizeC starts off with 0?? */ Container::Container(int maxCapacity){ capacityC = maxCapacity; elements = new int [capacityC]; sizeC = 0; } Container::~Container(){ delete [] elements; } Container::Container(const Container & origCont){ //copy constructor? int i = 0; for (i = 0; i<capacityC; i++){ //capacity to be used here? (*this).elements[i] = origCont.elements[i]; } } bool Container::empty() const{ if (sizeC == 0){ return true; }else{ return false; } } void Container::insert(int item, int index){ if ( sizeC == capacityC ){ cout << "\n*** Next: Bye!\n"; return; // ? have return here? } if ( (index >= 0) && (index <= capacityC) ){ elements[index] = item; sizeC++; } if ( (index < 0) && (index > capacityC) ){ cout<<"*** Illegal location to insert--"<< index << ". Container unchanged. ***\n"; }//error here not valid? according to original a3? have i implemented wrong? } void Container::erase(int index){ if ( (index >= 0) && (index <= capacityC) ){ //correct here? legal location? int i = 0; while (i<capacityC){ //correct? elements[index] = elements[index+1]; //check if index increases here. i++; } sizeC=sizeC-1; //correct? updated sizeC? }else{ cout<<"*** Illegal location to be removed--"<< index << ". Container unchanged. ***\n"; } } int Container::size()const{ return sizeC; //correct? } /* bool Container::operator==(const Container &rhs,const Container &lhs){ int equal = 0, i = 0; for (i = 0; i < capacityC ; i++){ if ( rhs.elements[i] == lhs.elements[i] ){ equal++; } } if (equal == sizeC){ return true; }else{ return false; } } ostream & operator<< (ostream & out, const Container & aCont){ int i = 0; for (i = 0; i<sizeC; i++){ out<< aCont.elements[i] << " " << endl; } } */ I dont have the other functions in the header file (just a quikie). Anyways, the last two functions in "/* */" I cant get to work, what am I doing wrong here? the first function is to see whether the two arrays are equal to one another

    Read the article

  • Insight into how things get printed onto the screen (cout,printf) and origin of really complex stuff

    - by sil3nt
    I've always wondered this, and still haven't found the answer. Whenever we use "cout" or "printf" how exactly is that printed on the screen?. How does the text come out as it does...(probably quite a vague question here, ill work with whatever you give me.). So basically how are those functions made?..is it assembly?, if so where does that begin?. This brings on more questions like how on earth have they made openGl/directx functions.. break it down people break it down.:)

    Read the article

  • determining True/False.

    - by sil3nt
    Hi there, the following code #include <iostream> using namespace std; int main(){ char greeting[50] = "goodmorning everyone"; char *s1 = greeting; char *s2 = &greeting[7]; bool test = s2-s1; cout << "s1 is: " << s1 << endl; cout << "s2 is: " << s2 << endl; if (test == true ){ cout << "test is true and is: " << test << endl; } if (test == false){ cout<< "test is false and is: " << test << endl; } return 0; } outputs: s1 is: goodmorning everyone s2 is: ning everyone test is true and is: 1 here what does the line bool test = s2-s1; actually evaluate?, is it the length of the string?. If so, then seeing as s2 is a smaller than s1 it should be negative correct?, and yet the output is true?. Also if i change it to bool test = s1-s2; I still end up with the same result. So it doesnt matter whether its negative or positive the it will be true? and only false when 0?. what does the s2-s1 mean? -cheers (trying to get rid of doubts:))

    Read the article

  • sorting names in a linked list

    - by sil3nt
    Hi there, I'm trying to sort names into alphabetical order inside a linked list but am getting a run time error. what have I done wrong here? #include <iostream> #include <string> using namespace std; struct node{ string name; node *next; }; node *A; void addnode(node *&listpointer,string newname){ node *temp; temp = new node; if (listpointer == NULL){ temp->name = newname; temp->next = listpointer; listpointer = temp; }else{ node *add; add = new node; while (true){ if(listpointer->name > newname){ add->name = newname; add->next = listpointer->next; break; } listpointer = listpointer->next; } } } int main(){ A = NULL; string name1 = "bob"; string name2 = "tod"; string name3 = "thomas"; string name4 = "kate"; string name5 = "alex"; string name6 = "jimmy"; addnode(A,name1); addnode(A,name2); addnode(A,name3); addnode(A,name4); addnode(A,name5); addnode(A,name6); while(true){ if(A == NULL){break;} cout<< "name is: " << A->name << endl; A = A->next; } return 0; }

    Read the article

  • pointer and reference question (linked lists)

    - by sil3nt
    Hi there, I have the following code struct Node { int accnumber; float balance; Node *next; }; Node *A, *B; int main() { A = NULL; B = NULL; AddNode(A, 123, 99.87); AddNode(B, 789, 52.64); etc… } void AddNode(Node * & listpointer, int a, float b) { // add a new node to the FRONT of the list Node *temp; temp = new Node; temp->accnumber = a; temp->balance = b; temp->next = listpointer; listpointer = temp; } in this here void AddNode(Node * & listpointer, int a, float b) { what does *& listpointer mean exactly.

    Read the article

  • Help with these warnings. [inheritance].

    - by sil3nt
    Hello there. I have a set of code, which mimics a basic library cataloging system. There is a base class named items, in which the the general id,title and year variables are defined and 3 other derived classes (DVD,Book and CD). Base [Items] Derived [DVD,Book,CD]. The programs runs, however I get the following warnings, I'm not sure how to fix these. "C:\Program Files\gcc\bin/g++" -Os -mconsole -g -Wall -Wshadow -fno-common mainA4.cpp -o mainA4.exe In file included from mainA4.cpp:5: a4.h: In constructor `DVD::DVD(int, std::string, int, std::string)': a4.h:28: warning: `DVD::director' will be initialized after a4.h:32: warning: base `Items' a4.h:32: warning: when initialized here a4.h: In constructor `Book::Book(int, std::string, int, std::string, int)': a4.h:48: warning: `Book::numPages' will be initialized after a4.h:52: warning: base `Items' a4.h:52: warning: when initialized here a4.h: In constructor `CD::CD(int, std::string, int, std::string, int)': a4.h:66: warning: `CD::numSongs' will be initialized after a4.h:70: warning: base `Items' a4.h:70: warning: when initialized here Exit code: 0

    Read the article

  • Installing gtk and compiling using gcc under windows? [solved]

    - by sil3nt
    I have gcc installed in c:/programfiles (also set as a path variable), and i have all the necessary files for gtk from http://www.gtk.org/download-windows.html, glib,gtk,pango,atk and cairo. Although I have no clue as to how to compile a c program using gtk with the gcc compiler. How do I set everything up so that it works?. (I don't know where each zip file goes.?) basically I don't really know where start.

    Read the article

  • left-hand operand of comma has no effect?

    - by sil3nt
    Hello there, I'm having some trouble with this warning message, it is implemented within a template container class int k = 0, l = 0; for ( k =(index+1), l=0; k < sizeC, l < (sizeC-index); k++,l++){ elements[k] = arryCpy[l]; } delete[] arryCpy; this is the warning i get cont.h: In member function `void Container<T>::insert(T, int)': cont.h:99: warning: left-hand operand of comma has no effect cont.h: In member function `void Container<T>::insert(T, int) [with T = double]': a5testing.cpp:21: instantiated from here cont.h:99: warning: left-hand operand of comma has no effect cont.h: In member function `void Container<T>::insert(T, int) [with T = std::string]': a5testing.cpp:28: instantiated from here cont.h:99: warning: left-hand operand of comma has no effect >Exit code: 0

    Read the article

  • A specific string format with a number and character together represeting a certain item

    - by sil3nt
    Hello there, I have a string which looks like this "a 3e,6s,1d,3g,22r,7c 3g,5r,9c 19.3", how do I go through it and extract the integers and assign them to its corresponding letter variable?. (i have integer variables d,r,e,g,s and c). The first letter in the string represents a function, "3e,6s,1d,3g,22r,7c" and "3g,5r,9c" are two separate containers . And the last decimal value represents a number which needs to be broken down into those variable numbers. my problem is extracting those integers with the letters after it and assigning them into there corresponding letter. and any number with a negative sign or a space in between the number and the letter is invalid. How on earth do i do this?

    Read the article

  • Quick question regarding this issue, Why doesnt it print out the second value(converted second value

    - by sil3nt
    Quick question, What have I done wrong here. The purpose of this code is to get the input into a string, the input being "12 34", with a space in between the "12" and "32" and to convert and print the two separate numbers from an integer variable known as number. Why doesn't the second call to the function copyTemp, not produce the value 34?. I have an index_counter variable which keeps track of the string index and its meant to skip the 'space' character?? what have i done wrong? thanks. #include <stdio.h> #include <string.h> int index_counter = 0; int number; void copyTemp(char *expr,char *temp); int main(){ char exprstn[80]; //as global? char tempstr[80]; gets(exprstn); copyTemp(exprstn,tempstr); printf("Expression: %s\n",exprstn); printf("Temporary: %s\n",tempstr); printf("number is: %d\n",number); copyTemp(exprstn,tempstr); //second call produces same output shouldnt it now produce 34 in the variable number? printf("Expression: %s\n",exprstn); printf("Temporary: %s\n",tempstr); printf("number is: %d\n",number); return 0; } void copyTemp(char *expr,char *temp){ int i; for(i = index_counter; expr[i] != '\0'; i++){ if (expr[i] == '0'){ temp[i] = expr[i]; } if (expr[i] == '1'){ temp[i] = expr[i]; } if (expr[i] == '2'){ temp[i] = expr[i]; } if (expr[i] == '3'){ temp[i] = expr[i]; } if (expr[i] == '4'){ temp[i] = expr[i]; } if (expr[i] == '5'){ temp[i] = expr[i]; } if (expr[i] == '6'){ temp[i] = expr[i]; } if (expr[i] == '7'){ temp[i] = expr[i]; } if (expr[i] == '8'){ temp[i] = expr[i]; } if (expr[i] == '9'){ temp[i] = expr[i]; } if (expr[i] == ' '){ temp[i] = '\0'; sscanf(temp,"%d",&number); index_counter = i+1; //skips? } } // is this included here? temp[i] = '\0'; }

    Read the article

  • destructor and copy-constructor calling..(why does it get called at these times)

    - by sil3nt
    Hello there, I have the following code #include <iostream> using namespace std; class Object { public: Object(int id){ cout << "Construct(" << id << ")" << endl; m_id = id; } Object(const Object& obj){ cout << "Copy-construct(" << obj.m_id << ")" << endl; m_id = obj.m_id; } Object& operator=(const Object& obj){ cout << m_id << " = " << obj.m_id << endl; m_id = obj.m_id; return *this; } ~Object(){ cout << "Destruct(" << m_id << ")" << endl; } private: int m_id; }; Object func(Object var) { return var; } int main(){ Object v1(1); cout << "( a )" << endl; Object v2(2); v2 = v1; cout << "( b )" << endl; Object v4 = v1; Object *pv5; pv5 = &v1; pv5 = new Object(5); cout << "( c )" << endl; func(v1); cout << "( d )" << endl; delete pv5; } which outputs Construct(1) ( a ) Construct(2) 2 = 1 ( b ) Copy-construct(1) Construct(5) ( c ) Copy-construct(1) Copy-construct(1) Destruct(1) Destruct(1) ( d ) Destruct(5) Destruct(1) Destruct(1) Destruct(1) I have some issues with this, firstly why does Object v4 = v1; call the copy constructor and produce Copy-construct(1) after the printing of ( b ). Also after the printing of ( c ) the copy-constructor is again called twice?, Im not certain of how this function works to produce that Object func(Object var) { return var; } and just after that Destruct(1) gets called twice before ( d ) is printed. sorry for the long question, I'm confused with the above.

    Read the article

  • How to convert between different currencies?

    - by sil3nt
    Hey there, this is part of a question i got in class, im at the final stretch but this has become a major problem. In it im given a certain value which is called the "gold value" and it is 40.5, this value changes in input. and i have these constants const int RUBIES_PER_DIAMOND = 5; // relative values. * const int EMERALDS_PER_RUBY = 2; const int GOLDS_PER_EMERALDS = 5; const int SILVERS_PER_GOLD = 4; const int COPPERS_PER_SILVER = 5; const int DIAMOND_VALUE = 50; // gold values. * const int RUBY_VALUE = 10; const int EMERALD_VALUE = 5; const float SILVER_VALUE = 0.25; const float COPPER_VALUE = 0.05; which means that basically for every diamond there are 5 rubies, and for every ruby there are 2 emeralds. So on and so forth. and the "gold value" for every diamond for example is 50 (diamond value = 50) this is how much one diamond is worth in golds. my problem is converting 40.5 into these diamonds and ruby values. I know the answer is 4rubies and 2silvers but how do i write the algorithm for this so that it gives the best estimate for every goldvalue that comes along?? please help!, im at my wits end

    Read the article

  • Installing gtk and compiling using gcc under windows?

    - by sil3nt
    I have gcc installed in c:/programfiles (also set as a path variable), and i have all the necessary files for gtk from http://www.gtk.org/download-windows.html, glib,gtk,pango,atk and cairo. Although I have no clue as to how to compile a c program using gtk with the gcc compiler. How do I set everything up so that it works?. (I don't know where each zip file goes.?) basically I don't really know where start.

    Read the article

  • base destructor called twice after derived object?

    - by sil3nt
    hey there, why is the base destructor called twice at the end of this program? #include <iostream> using namespace std; class B{ public: B(){ cout << "BC" << endl; x = 0; } virtual ~B(){ cout << "BD" << endl; } void f(){ cout << "BF" << endl; } virtual void g(){ cout << "BG" << endl; } private: int x; }; class D: public B{ public: D(){ cout << "dc" << endl; y = 0; } virtual ~D(){ cout << "dd" << endl; } void f(){ cout << "df" << endl; } virtual void g(){ cout << "dg" << endl; } private: int y; }; int main(){ B b, * bp = &b; D d, * dp = &d; bp->f(); bp->g(); bp = dp; bp->f(); bp->g(); }

    Read the article

  • template warnings and error help, (gcc)

    - by sil3nt
    Hi there, I'm working on an container class template (for int,bool,strings etc), and I've been stuck with this error cont.h:56: error: expected initializer before '&' token for this section template <typename T> const Container & Container<T>::operator=(const Container<T> & rightCont){ what exactly have I done wrong there?. Also not sure what this warning message means. cont.h:13: warning: friend declaration `bool operator==(const Container<T>&, const Container<T>&)' declares a non-template function cont.h:13: warning: (if this is not what you intended, make sure the function template has already been declared and add <> after the function name here) -Wno-non-template-friend disables this warning at this position template <typename T> class Container{ friend bool operator==(const Container<T> &rhs,const Container<T> &lhs); public:

    Read the article

1 2  | Next Page >