1,080,661 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Posts by firstPerson which have been Voted Down

ok cool, don't forget to delete what you new-ed. What is your question?

firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15

Also, if you really need to findFather, since it looks like it is being used extensively, consider adding another pointer in your Node. That new pointer would just point to its parent if any.

firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15

Take the BMP image, copy it into paint. Then save it as JPEG

firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15

@OP:

int userInput = 0;
const int QUIT = 8;
do{
  cin >> userInput;
  switch(userInput){ 
     case ADD: doAdd(); break;
     case SUB: doSub(); break;
     case MULT: doMult(); break;
     case DIV: doMult(); break;
     case FACT: doFact(); break;
     case QUIT: break;
     default: doErrorInput(); break;
  }
 if(userInput != QUIT){ showMenu(); }

}while(userInput != QUIT);
firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15

Easy enough, assuming some things.

int maxVal  = INT_MIN;
int minVal = INT_MAX;
int input = -1;
const int END  = -1;
while( cin >> input ){
  if( input == END) break;
  else{
    minVal = std::min(minVal,input);
    maxVal = std::max(maxVal,input);
  }
}
firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15

Read this. It has very good explanation.

firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15

Orange gorilla and blue tires

firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15

>>Can someone explain to me what I am doing wrong
EVERYTHING

This is what you want :

#include <string>
#include <iostream>
using namespace std;

int main(){
 string line;
 getline(cin,line); //read a line
 /* do stuff with the line */
}
firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15

I did this for my university like 3 years ago. The exact same problem. I still have it, for a price.

firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15

darn double post. Well this post is useless. Maybe there will be something here that you
would find useful. But I doubt that anything in this post will be useful to you, whoever you
are. Well, at least I made this post worth something, in my opinion of course. So anyone here doing
anything interesting projects or whatever? I tried to make the most of this post. Well thank you for
reading and wasting a few minutes or seconds of your life. Goodbye.

firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15

can't to work with this, because user input is string type name (:

string stringName = "goshy";
char charName = "goshy";

cout << stringName[0] << " " << stringName[1] << endl;
cout << charName[0] << " " << charName[1] << endl;

strings are made to replicate char arrays but be better

firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15

>>the best way to promote C++0x is to use it and teach it, yes

Lol, yes. But lets leave that to the C++0x forum.

firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15

What part of C++ troubles you, my young lad?

firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15
firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15

Is it just me, or does it seems that people posting here are getting dumber and dumber? Dang if its this hard for you then, go work at McDonalds or something.

firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15

So all chars to be possible are numbers (0x30 .. 0x39) only ?

Why only should chars be converted into integers, aren't they already integers (0x00 ... 0xff) internally?

-- tesu

Actually, I mis-read his post. Sorry.

firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15

If its only 1-3 length, then just hard code it like so :

int toInt(const string& str){
 int result = 0;
 switch(str.length()){
   case 1: result = str[0] - '0'; break;
   case 2: result = (str[0]-'0')*10 + (str[1] - '0'); break;
   case 3: result = (str[0]-'0')*100 + (str[1] - '0')*10 + (str[2] - '0'); break;
   default: /* not supported */ break;
 }
  return result;
}
firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15

Do something like this :

class Polynomial{
 private:
 std::vector<int> coeff; //the coefficiants
 public:
 void getInput();
 void printPolynomial();
}

its pretty much similar to yours except I use a vector instead of raw arrays.
Now just implement the input and output functions.

firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15

Right now forget about creating games. Its over your head, unless you
want to use something like gamemaker or something similar.
First learn how to program. Pick a language, whether it be C++ , python,
C# or whatever. After you get a decent amount of experience in programming, then you can move on to 2d or 3d if you want.

firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15

>> What are we even trying to measure

You are trying to measure BigO(), Big ) measures the growth rate of an algorithm. For example say there is a function f(n) , and that it follows the following inequality :

O( log(n) ) < f(n) < O(n)

the above inequality says that the function f(n) is bounded on top by
O(n), that means its worst performance is O(n). That O(n) is bigO(n).

It approximates how fast or slow the performance of an algorithm is.

To start your algorithm, depth-first-search is a well known one.
Its not easy to evaluate its performance. Thats why you can
quote whats already been proven. Take a look here and
read about its performance.

firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15
 
© 2013 DaniWeb® LLC
Page generated in 0.2145 seconds using 2.75MB