mrnutty 761 Senior Poster

If its to learn C++, then I suggest you to do this.

1) In a file list all of the participants name
2) From your program, read/store the participants name
3) Pick a random name and output

It will be easier if your program just shows the random person's name instead of having the user enter 'Go'

Alternatively, if you don't have a lot of names, then it might be easier to hard-code the names in a vector. And then shuffle it and pick a random name. Judging from your post it looks like you only have a few names. In that case, it might be easier to do hardcode it.

Here is a sample code that you can work with.

#include <iostream>
#include <algorithm> //to randomly shuffle
#include <vector> //our container
#include <string>
using namespace std;

int main(){
  vector< string > fruits;
  fruits.push_back("apple"); //add a fruit to our container
  fruits.push_back("orange");
  fruits.push_back("pear");

  //randomly shuffle the vector
  std::random_shuffle( fruits.begin(), fruits.end() ); //reorders the container in random order
  
  string pick = fruits[0]; //pick the first element, could be any since the container was 'shuffled'
 cout << "Today, you should eat " << pick << " for breakfast " << endl;

 return 0;
}
mrnutty 761 Senior Poster

No you can't cin a enum unless you define it yourself.

mrnutty 761 Senior Poster

>>By the way, i have this feeling that if lets say i get the hang with one Lib and then move to another that the previous Lib ive learned would go to waste, is it something i should worry about?

That's kind of an awkward question. I mean, throughout the years you will learn how to use different libraries for different things. Everything is a tool and tools will and can be replaced.


>>P.S i was using Dark GDK lib but i did not like it as much because it did all the job for me while i didnt understood how the libs code-work is done, isnt SDL something similar?

Listen, I was like you at one point. For example not wanting to use an image loading library because I didn't want to use someone else's code. But when you get more mature, you come to realize that its not always about knowledge, its about productivity. In your free time its ok to learn new skills. But in real world you will be using some tool that you didn't write. So get over it ;).

And as for SDL, I would strongly suggest you to go for it, else you can learn OpenGL. What you should concentrate at this stage is not how to load a image or do a certain task, but you should concentrate on learning to program effectively. This can only be done by practicing to program. So grab something …

mrnutty 761 Senior Poster

Why don't you move away from console application, and move into more graphics? Use libraries like SDL to make a simple 2D game. That way you will enjoy what your doing and you will be learning.

mrnutty 761 Senior Poster

Piece of cake, kinda crude approximation tho.

#include <iostream>
#include <cmath>
#include <string>
#include <vector>

using namespace std;

const unsigned CANVAS_WIDTH = 20;
const unsigned CANVAS_HEIGHT = 20;
const unsigned char BACKGROUND_FILL = '#';
const char POINT = '*';
const float PI = 3.14159265f;
const float DEGREE_TO_RADIAN_FACTOR = 0.0174532925f;

typedef std::vector<std::string> Canvas;

float toRadians(const float deg){ return deg * DEGREE_TO_RADIAN_FACTOR;}
int roundPositive(const float n){ return int(n + 0.5f); }

Canvas createDefaultCanvas(){
 return Canvas(CANVAS_HEIGHT, std::string(CANVAS_WIDTH,BACKGROUND_FILL) );
}
void fillCircle(Canvas& canvas,const unsigned radius){

 const int canvasMidX = canvas[0].size() / 2; //assume same width for each height
 const int canvasMidY = canvas.size() / 2;
 const int STEP_SIZE = 1;
 for(int deg = 0; deg < 360; deg += STEP_SIZE){
     float radian = toRadians(deg);
     float x = cos(radian) * radius + canvasMidX;
     float y = sin(radian) * radius + canvasMidY;
     x = roundPositive(x);
     y = roundPositive(y);
     canvas[y][x] = POINT;
 }
}

void showCanvas(const Canvas& canvas){
 for(unsigned height = 0; height < canvas.size(); ++height){
  for(unsigned width = 0; width < canvas[height].size(); ++width){
   cout << canvas[height][width];
  }
  cout << endl;
 }
}
int main(){
 using namespace std;

 const unsigned RADIUS = 5;
 Canvas canvas = createDefaultCanvas();

 fillCircle(canvas,RADIUS);

 showCanvas(canvas);

 return 0;
}

example output :

####################
####################
####################
####################
####################
########*****#######
######***###***#####
######*#######*#####
#####**#######**####
#####*#########*####
#####*#########*####
#####*#########*####
#####**#######**####
######*#######*#####
######***###***#####
########*****#######
####################
####################
####################
####################
mrnutty 761 Senior Poster

Yes, but it will be a little work

1) Use Java's JNI to talk to C++ program/functions
2) Use phonegap, javascript to talk to JAVA program.
3) Now your application works with android/iphone and Blackberry 6 or higher

mrnutty 761 Senior Poster

Just for exercise, if people want to give it a go; see how creative one can be.

Problem Statement: Given a list of data from a file( or user input which ever) as such:

char 1
char 2
char 26 
char 27
char 52
char 53

output the mapping of the number like so:

char 1 => 'a'
char 2 => 'b'
char 26 = 'z'
char 27 => 'A'
char 52 => 'Z'
char 53 => 'aa'

If you don't see the pattern then here it is:

[1...26] gets mapped to ['a'...'z']
[27...52] gets mapped to ['A'...'Z']

any thing after 52, ex 53 gets wrapped back. For example 53 gets wrapped to 'aa' or 54 gets wrapped to 'bb' or 79 gets wrapped to 'AA'
Free to use any language paradigm....blah...blah...blah, just make sure its understandable.

Difficulty: 2.0f/5.0f

m4ster_r0shi commented: Make more threads like this one! +7
mrnutty 761 Senior Poster

Not a clue. Can't read the error message, you don't tell us what line it's on, and your indenting is baaaad.

Give people some break would you. Not all are fluent in english or do they have enough skills to communicate in english. And since he is a beginner, one should expect bad question like this.


@OP, I'm not completely sure why you are doing the things you are doing, but here is a simple fix,

#include "stdafx.h"
#include <iostream>
#include <string>
int printing(const std::string& name);
 
int main()
{
	using namespace std;
	cout << "Enter your name:" << endl; 
        string name;
	cin >> name; 
	printing(name);
	return 0;
}	
 
 
 
int printing(const std::string& userName)
{
	using namespace std;
	cout << "Hello,"<< userName << endl;
		return 0;
}

you need to define, main, which is the entry point of the program;where the program starts. You also need to use std::string if you want the user to input characters.

WaltP commented: So if it was a Spanish board he would have given us more info? It's just harder in English? I don't think so. -4
jingda commented: Waltp is a bit harsh. I see no point that you should get down rep +10
mrnutty 761 Senior Poster

Ok here is an analogy I head and I will try it out:

Imagine you picked a hotel, and then you bought a room, so they gave you the key to that room. You take out your bible, read it and then put it inside your drawer. Next morning you have to leave because your time is up. You pack everything up and leave, but you left your bible in the drawer and you forgot to hand in your key. Next day you remember that you left your bible in the drawer and you remember you still have the key to that room. Now you know your not allowed to go to that room because your time is up, but you figure, what the hell I'll just see if this key works and try to get my book back. Surprisingly, your key does work and what do you know your book is still in the drawer. Why would anyone remove it anyways? They probably didn't need that space yet, so they just left it as it, which is why your book was still there.

Now use the above analogy to the problem you've shown. You picked a hotel, in your case, its called Pig. You rented a room, in your case its room Jack. Now you have a key to that room, the pointer. You do stuff in that room, in your case call Rof(), and your day has expired, you called delete on Jack, now you come …

mrnutty 761 Senior Poster

>>char*** b_array_ptr

You can think this as a pointer to a 2D array of chars. Example will suffice:

#include <iostream>
using namespace std;

int main(){
 char ***ptr = 0;
 //dynamically initialize it
 const int WIDTH = 3;
 const int HEIGHT = 3;
 const int DEPTH = 3;
 
 ptr = new char**[DEPTH];

 //allocate memory
 for(int i = 0; i < DEPTH; ++i){
    ptr[i] = new char*[HEIGHT];
 }
 for(int j = 0; j < DEPTH; ++j){
   for(int k = 0; k < HEIGHT; ++k){
      ptr[j][k] = new char[WIDTH];
    }
  }

 //populate it
 for(int i = 0; i < DEPTH; ++i){
   for(int j = 0; j < HEIGHT; ++j){
     for(int k = 0; k < WIDTH; ++k){
          ptr[i][j][k] = 'A' + (i * j * k) % 27;
     }
   }
 }

  //print it
  for(int i = 0; i < DEPTH; ++i){
   for(int j = 0; j < HEIGHT; ++j){
     for(int k = 0; k < WIDTH; ++k){
          cout << ptr[i][j][k] << " ";
     }
     cout << endl;
    }
   cout << endl;
  }
 
 //deallocate it
  for(int i = 0; i < DEPTH; ++i){
   for(int j = 0; j < HEIGHT; ++j){
     delete [] ptr[i][j];
   }
    delete [] ptr[i];
  }
  delete [] ptr;
  return 0; 
}
fruitymo commented: Thank you for this! I understood the fact that char*** is a pointer to 2D array of chars but I struggled to allocate memory for all 3 dimensions. This comment has been of great help. +0
mrnutty 761 Senior Poster

In WinAPI almost all structures and classes are in all caps so that might just be a convention you follow.

True in a sense that it could be a convention one can follow, but it doesn't mean its a good convention. But you have to understand that the windows API is really old. Even the windows API uses all caps for constant data types, but they also use all caps for certain structures. And they also mix up the two, that is use all caps for constant structure. If you were developing the windows api library, then you should follow their convention, but since this is C++, you should follow C++ convention. And although there aren't a standard convention, there are some widely used convention and its best not only for the creator but also for future maintainer to use convention that they will naturally understand.

mrnutty 761 Senior Poster

There are some serious problems with your code. Here is a fix. I'll let someone explain it, because I don't have enough patience right now.

#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

void DistanceofTwoCars(float *car1, float *car2){
	cout << "The Distance between Car 1 and Car 2 is... " << endl;
	cout << endl;
	cout << "D = " << (float)sqrt(pow(car2[0] - car1[0], 2.0f) + pow(car2[1] - car1[1], 2.0f) + pow(car2[2] - car1[2], 2.0f)) << endl;
}

int main()
{
	float car1[3]; //Car 1 has 3 coordinates
	float car2[3]; //Car 2 has 3 coordinates

	// Car 1's ( X, Y, Z ) Coordinates
	cout << "What is the X Coordinate of Car 1? ";
	cin >> car1[0];
	cout << endl;
	cout << "What is the Y Coordinate of Car 1? ";
	cin >> car1[1];
	cout << endl;
	cout << "What is the Z Coordinate of Car 1? ";
	cin >> car1[2];
	cout << endl;
	cout << "The coordinates of Car 1 are..." << " ( " << car1[0] << "," << car1[1] << "," << car1[2] << " )" << endl;
	cout << endl;

	// Car 2's ( X, Y, Z ) Coordinates 
	cout << "What is the X Coordinate of Car 2? ";
	cin >> car2[0];
	cout << endl;
	cout << "What is the Y Coordinate of Car 2? ";
	cin >> car2[1];
	cout << endl;
	cout << "What is the Z Coordinate of Car 2? ";
	cin >> car2[2];
	cout << endl;
	cout …
Zvjezdan23 commented: Thank you so much for your help. I really appreciate you helping me out. +0
mrnutty 761 Senior Poster

Make your class as such:

class dm_energy_vec
{
public:
        dm_energy_vec(){}
        dm_energy_vec(const vector<float>& vec): m_energy_dep(vec){}
	vector<float> m_energy_dep;
};

and in line 40, change to:

energy_dep_sum.push_back( dm_energy_vec(energy_dep));

but honestly see no point for that class.

mrnutty 761 Senior Poster
while(begin != end )  
    words[*begin++]++;

is the same as:

while(begin != end )    //<-- I believe the stream iterator is getting input here
 {    
    int count = words[*begin]; //get the value for the given word
    words[*begin] = count + 1; //increase the count by 1 
    ++begin; //move to next word
 }
mrnutty 761 Senior Poster

>>Why is it a bad idea to use the std namespace for my new functions? If all of my functions have names which are different than the names of std functions, it is no harm, right?

No do not do that. To avoid conflicts( perhaps in the future), you should strive for modularity. That is, think of namespace std as a unit which is part of the standard library, and now create your own namespace, and think of that as a different unit thats related to your application, and you may possibly have other namespaces from for example 3rd party library, and so you could think of those namespace as a different unit.


>>Also, it is more convenient because I won't have to write std::function every time I want to call a function in my program. (Or if my program uses the standard, I would have to use myname::function every time I want to use a function from my header file.)

What convenient for you might not be convenient for others. When you program you should program it so that it is easy to maintain. Although it might solve your solution right now, would it cause problems later on the road? Is your solution clear and intuitive?

And whats just one more line to solve your program? Don't be lazy, you can easily say using namespace MyOwnNamespace; and go on from there.

mrnutty 761 Senior Poster

Presumably I'll have a family by then, So I'll hang around with them, Im a fun guy!!! Other than that, I have no idea, only time will tell

mrnutty 761 Senior Poster

You can delete line 158 and 193. Also quoted strings i.e "quotedStrings" are automatically null terminated via compiler, so you don't have to manually add null character like you did here "-c\0"

mrnutty 761 Senior Poster

>>Any linked data structure has that benefit, but it's not the point of linked lists[1]. I'd argue that the point of a linked list is the principle benefit, which would be efficient growth (ie. insertion and deletion) in the absence of random access

I would like to point out one thing, in theory insertion/deletion is constant in a usual linked list implementation, but however one should think about it practically. Since the memory is all over the place in linked list, its not cache friendly, thus causes( or can cause ) a lot more cache misses, which would increase the latency time. Thus when you think you need linked list, you might be able to get away with using an array, especially if the order doesn't matter. If the order doesn't matter then you can achieve constant insertion and deletion with arrays too!! And its cache friendly. But as usual, it all depends. Its just a thought I figure to share.

mrnutty 761 Senior Poster

I just found out that my work might get into the companies next release. Whoot whoot. Partayyy. But first I need to make this program bug free, or at least cover upto 80% of it.

mrnutty 761 Senior Poster

Post your code.

mrnutty 761 Senior Poster

Just one more things, for question 2, its not a char type, its a array to chars, which is why in the above post, you see an array of chars

mrnutty 761 Senior Poster

Thanks a ton! That worked perfectly.. however now there is the issue of declaring a variable without defining it - this gives me the same multiply defined error...
I declare SDL_Event event; in the header file and when I do not define it I get the error, because it is undefinable really unless an event takes place

Why does that need to be a global?

Schol-R-LEA commented: Why oh why didn't I think to ask that? +7
mrnutty 761 Senior Poster

Your factorial is wrong. Since you are updating by 2, you are missing terms in your factorial.

Separate the factorial into its own function. Or do this:

double sineSeries(double x, int n){
	double xPower = 0.0;
	double factorial = 1.0;
	double sineComputed = 0.0;
	bool sign = true;

	for (int i=1; i<=n; i+=2,factorial *= (i-1) * i){
		xPower = pow(x,i);

		if (sign) {
			sineComputed += xPower/factorial;
		}
		else {
			sineComputed -= xPower/factorial;
		}
		sign = !sign;
	}

	return sineComputed;
}
mrnutty 761 Senior Poster

Another simple idea is to make a rock-paper-scissor game. It fits perfectly. There is no optimal algorithm in the sense that it will never lose. But one can code up a learning machine that could find patterns from human inputs and hence try to predict next behavior.

mrnutty 761 Senior Poster

You should do something like this :

const string& stringToAvoid = "#\n"; 
string line;
while(getline(cin,line)){
  if(stringToAvoid.find(line[0]) != string::npos) continue;
}

that way you can just add more character to stringToAvoid instead more if's

NathanOliver commented: Nice +9
mrnutty 761 Senior Poster

Wow are we really having a 4 page long thread about this. I don't get whats the problem. You guys/girls/its needs to get some fresh air and forget this thread ever happened

WaltP commented: Especially since the OP has made 1 single post. +16
mrnutty 761 Senior Poster

You should really use constants like so :

const int COORD_X = 0;
const int COORD_Y = 1;
const int LEFT = 0;
//....

int past[1000][2]; and says that 0 is side, and 1 is up.

Just so we are clear, past[0] should move the snake sideways, that is left and right
and past[1000][1] should move the snake up and down

mrnutty 761 Senior Poster

@OP or a more generic approach:

struct InvalidInputException : std::exception{
 InvalidInputException(): std::exception("Error: Invalid conversion") {}
};

//tries to get a data of type T, throws InvalidInputException if failed
template<typename T>
T prompt(const std::string msg){ 
  cout << msg ;
  T res = T();
  if( ! (cin >> res) ){ 
      cin.clear();
      while(cin.get() != '\n' ) continue;
      throw InvalidInputException();
  }
 else return res;
}

int main(){
 try{
   int age = prompt("What is your age? ");
   string name = prompt("What is your name? ");
  }catch(std::exception& e){ cout << "whyyyyyyy?\n"; }
}

@psuedorandom: I like that solution but some things,

1) The name int_type is misleading since the user can use that function to get a string for example.
2) I don't like the performance issue with writing just one input to a file everytime that function is called, I would rather do lazy write and write only when necessary.


and I guess whether the function should throw exception on failed input is a matter of choice.

mrnutty 761 Senior Poster

Forgot to mention you need to use fixed format:

double d = 5.0;
cout << fixed << setprecision(1) << d << endl;
mrnutty 761 Senior Poster

Now when you have the basics of programming, you can go for .NET platform? or may be C++ in another case. I have seen a lot of C++ experts out there in DW like Salem, Ancient Dragon. Great guys to learn something from, Cheers!

No offense to them, but I would say there are like 9 experts in C++ in the whole world, by experts, one who knows the language inside and out, so I wouldn't say they were experts, but rather, knowledgable.

mrnutty 761 Senior Poster

idk too much about jQuery but it seems you can abstract:

<script>
function foo(name,id)
{
       var $j = jQuery.noConflict();
	$j(function() {
	    $j(name).click(function(evt) {
		$j(id).load("content.php?order=most&f=recent")
		evt.preventDefault();
	    })
	})

}

 foo("mostrec","#1");
 foo(".leastrec","#1");
 //...so on
</script>
Pinchanzee commented: Simple + effective +2
mrnutty 761 Senior Poster

Just a quick thought on this topic...

If you're a confused Christian, then perhaps you're not a Christian (which is not a bad thing). In other words, it's almost like a left handed person is being forced to be a right handed person.

Perhaps I'm not or perhaps I am, but thats what I'm trying to find out, who I am and what I believe in. Been doing a lot of research lately, and its becoming more clearer to me, but still hazy. But in time...

Thanks everyone for your responses and criticism.

regards, D.Chhetri

Azmah commented: your welcome :D +0
mrnutty 761 Senior Poster

First of all, I am a confused christian, and I am creating this thread to see if I can clear out some fog in my head. So lets start.

Claim: The bible is false in the sense that it was not written with the guidance of "god"

Reasons for my claim :

  1. Originally there was a lot of contradiction in the bible because it was written by humans
  • These contradictions were refractor-ed by a humans, specifically some committee of who's name I can't recall
  • No claims, if it wasn't for all of these refractor, more and more people will be aware of such contradiction and hence people will start to question and possible see the problems with the bible. Which could cause a tremendous loss in the business of selling bibles and spiritual objects

[*] There are things in the bible, still, that regular people find disturbing, such as the topic of homosexual, or parsing men more important than women.

  • Really, if it was written by god's disciples, and were the words of god, then such discrimination shouldn't exist, because god is suppose to love everyone of every type.
  • It also says that unless you follow him specifically, you will live eternity in hell? WTF!!! My family members are hindu, they are one of the best people that I know. My friend is not a believer in jesus, but possibly of a creator in general. He is one of the …
mrnutty 761 Senior Poster

>It sounds absurd that google can keep by gmail in their database and sell it to whomever

You'd think wouldn't you. But the 'google-sphere' is probably more sinister than we realize, or at least has the potential to be. They probably even keep tabs on what users search for.

Building these type of profiles can clearly bolster their dominance over would be competitors, yahoo pffft. Anyway, I digress.

Your making google sound like the government lol.

Azmah commented: very creative thought firstPerson XD +0
mrnutty 761 Senior Poster

On the contrary to whats being said, I advice you to not google it, not use std::reverse and not use std::string.rbegin() in conjunction with std::string.rend().

Your purpose should be to get better at programming, so one day you can solve problems by rational thinking, instead of googling everything. Then you will be more valuable. So first think of what you need, write ideas on notepad. Then try to implement it. We will be here waiting to help you in any way possible.

mrnutty 761 Senior Poster

No it deactivates it, but if you sign in within 2 weeks it reactivates it for you. If you pass the 2week period then they 'delete' it, but they might have you still on their database who knows. If you want to stop using it for a bit, then tell your friend to change your password and not give it to you until a week or so.

mrnutty 761 Senior Poster

@firstPerson


Statements like this bother me because areas in which something like this might be practical are so well funded and probably top-secret there is no way in hell that you know that. You might be surprised.

Your right. I'm in on position to claim such a thing, because I do not work with the leading speech recognition company, however just doing some research for example this, states that with just a vocabulary of 1000 words, the state of the art speech recognition is about 97% accurate. Now you might its pretty good, but thats under controlled condition, hence not in general, and also realize that on average humans have a range of vocabs from 10k to 150k, thus the error rates naturally increases as observed experimentally*. The military probably have some of the smartest people in the world working on such things, but at least to the general public, there is no perfect speech recognition software, for the general case. Although there are probably some that are very good.

mrnutty 761 Senior Poster

Chocking a chicken that's the best anyone could think of?

Have a big pot of some black coffee, break out the full flavored smokes and lean back to scan the room, letting it all settle in, you ponder why you've confined yourself in a room to stare at the glowing box with its radiant warmth. How long till your eyes ache, and you're regretting your missing time?
You've got beat this addiction, before it has you injecting pure internet forums intravenously, in the back of a hotel alleyway.

Sounds like a good time. I'm sure OP is just going through a phase. I was addicted to internet forum at one point ( lol ).

@OP, gather some friends, and go to movies, go clubbing, go out! Get away from the house. Go workout. Learn something new, how old are you?

iamthwee commented: Sounds like you got the overall balance just about right. +0
mrnutty 761 Senior Poster

You can do it through a conversion operator :

class PositiveInteger{
  int i;
public:
  PositiveInteger(int i1 = 0 ) 
   { i = i1 <  0 ? 0 : i1; }
  operator int(){ return i; }
};
int main(){
 PositiveInteger i(23);
 int j = i; //convert to int
}
pseudorandom21 commented: I learned something. +6
mrnutty 761 Senior Poster

Casting in that example if fine. But looking at your code, you are probably going to want to encapsulate the member variables, that way operator< does not have to be a friend function.

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

class StrategyKey
{
public:
	StrategyKey(){}
	~StrategyKey(){}

	StrategyKey(const char* strA):
		str_strategy(strA)
	{}
       virtual const std::string& getStrategyValue()const{ return str_strategy; }
private:	
	std::string str_strategy;
};

class TechniqueKey : public StrategyKey
{
public:
	TechniqueKey(){}
	~TechniqueKey(){}

	TechniqueKey(const char* strA, const char* strB): StrategyKey(strB),
		str_technique(strA)
	{}
        const std::string& getStrategyValue()const{ return str_strategy; }
private:
	string str_technique;
};

bool operator< (const StrategyKey& stratKeyA, const StrategyKey& stratKeyB){
 return stratKeyA.getStrategyValue() < stratKeyB.getStrategyValue();
}

bool operator< (const TechniqueKey& stratKeyA, const TechniqueKey& stratKeyB){
 const int cmp = stratKeyA.getStrategyValue().compare( stratKeyB.getStrategyValue() );
 if( cmp != 0 ) return cmp < 0;
 else{ //same so compare base values
   return dynamic_cast<const StrategyKey&>(stratKeyA) < stratKeyB; 
 }
}
Jsplinter commented: Thanks! I need to read up on friend functions. +2
mrnutty 761 Senior Poster

Unfortunately, I don't have one. Good luck with your project, sounds interesting.

mrnutty 761 Senior Poster

Well yea. If the user moves the stick from initial position to end position in a fast time, then you would expect the mouse to move in a fast time as well, right? Its like the mac, touch pad; touch the pad at one position, and quickly move it to a destination , then the mouse would have to quickly move to the destination as well right? And if the user slowly moves the the stick then the mouse should move slow as well right?

mrnutty 761 Senior Poster

ok stuff like this might be a little test and trial. But how about saving three states, previous mouse position, post mouse position, and time interval of movement. This way you can derive the rate at which the user locks the stick in a position. Then use that information to transform it into mouse speed.
When your mapping it into the screen, are you using windows for manipulating the mouse or are you using other libraries? How about having a matrix that transforms logical position into pixel position( ex. (0,0) map to pixel (x0,y0) and (1,1) map to pixel(x1,y1) ) but you need to take into account the viewing perspective to differentiate the length between the amount of pixel from x = 0 to x = 1( assuming x is horizontal axis). This is what essentially opengl does.
And there might be libraries out there that takes care of this for you already so check that out as well.

mrnutty 761 Senior Poster

It has made me more creative.

Thats very true. I started to think more logically in my everyday life. I realize that using rational thinking is the proper way of life, but of course there are some lines to draw rational thinking versus beliefs.

Hani1991 commented: Do you know that my belief is completely rational? :) +0
mrnutty 761 Senior Poster

Whats the point of car? I mean given the material we should be able to create one right?

mrnutty 761 Senior Poster

You need to define it as a function :

void send(int *to,int *from, int count)
{
         {
                 register n=(count+7)/8;
                 switch(count%8){
                 case 0: do{     *to++ = *from++;
                 case 7:         *to++ = *from++;
                 case 6:         *to++ = *from++;
                 case 5:         *to++ = *from++;
                 case 4:         *to++ = *from++;
                 case 3:         *to++ = *from++;
                 case 2:         *to++ = *from++;
                 case 1:         *to++ = *from++;
                         }while(--n>0);
                 }
         }
}
mrnutty 761 Senior Poster

- I have started to grow grey hair after I started programming
- I have started to have notorious thoughts about my computer after I started programming.
- I have started to think like a semi-computer in my daily life

susheelsundar commented: lolololololol +0
mrnutty 761 Senior Poster

The above code is garbage and wont work for every compiler. Its trying to point to the address 0xE6EB54. Don't bother wasting your time with these nonsensical code.

mrnutty 761 Senior Poster

Suggestion is to use std::string and std::sort. Its just a few liner :

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

int main(){
 std::string input;
 cin >> input; //get input
 std::sort(input.begin(),input.end()); //sort it
 cout << input << endl; //print it
 //or access each element like so 
 /*
     for(int i = 0; i < input.size(); ++i){ 
        cout << str[i] << " ";
     }
 */
}
naseerhaider commented: very helpfull +1
mrnutty 761 Senior Poster

>>Is there a way I can find out which derived type 'baseItt' is pointing to? I need this to help me with saving and loading in my program.

Consider having a save function for each class instead.