tux4life 2,072 Postaholic

What about the following ones ?

> http://mattmccutchen.net/bigint/
> http://sourceforge.net/projects/cpp-bigint/

Edit:: If you're using one of these libraries it's easy to write your own modPow() function :) ...

tux4life 2,072 Postaholic

here is the error
__STL::out_of_range

What about this ?

deepglue555 commented: somewhat helpful +1
tux4life 2,072 Postaholic

Great! I have the compiler! now what?

(download the zip-file)

Now you read the instructions which came with the allegro package, just keep on asking if you don't understand something :) ...

tux4life 2,072 Postaholic

Maybe wxWidgets as it matches with your avatar :P ...

tux4life 2,072 Postaholic

There's nothing wrong with using the goto-statement, but overwhelming use of it makes your code very difficult to understand and extremely hard to debug, so my advice is: avoid it as much as you can and use it only when there's no other possibility left :) ...

tux4life 2,072 Postaholic

Try this library - http://www.libxl.com

Yeah, but it isn't a free one, try searching wotsit.org instead ...

Maybe the following link is also useful for you: http://chicago.sourceforge.net/

tux4life 2,072 Postaholic

I think there are written lots of books about QT ...
Linux desktop environment KDE is also QT-powered ...

But personally I think wxWidgets is easier to learn, actually you should just try both of them, and stay with the one you feel yourself most comfortable with :) ...

tux4life 2,072 Postaholic

If you're talking about the C++ class basic_string then you can just pass a string to a function in the same way as you're doing with a normal variable :) ...

e.g.:

void strFunc([B]string s[/B])
{
    cout << s << endl;
}
tux4life 2,072 Postaholic

Hmm, to use of the getline function makes me think about the following thread:
http://www.daniweb.com/forums/thread90228.html

tux4life 2,072 Postaholic

Replace in.ignore(); with continue; to "ignore" the current character in n.

That's definitely the way to go !! :)

tux4life 2,072 Postaholic

Just image recognizing only won't solve the Mahjongg game, as the program also has to respect the rules of the game, but I assume this isn't the problem ...

tux4life 2,072 Postaholic

Can you post the code which is causing the error (using code tags :P), as the code you posted is compiling with me ...

tux4life 2,072 Postaholic

Dev-C++ starts getting dated, use the newest MinGW-compiler(s) instead ...
Edit:: Actually there comes a document with the distribution which describes the whole process ...
Edit:: Look at this link (STEP 1) to find more information on how to install the MinGW-compiler

tux4life 2,072 Postaholic

Use RockXP !
It's free and it will recover your Windows XP CD Key :) ...

tux4life 2,072 Postaholic

many choices... and i have to make it work really fast

In that case I would just use the previous suggested solution:
http://www.daniweb.com/forums/post843593-5.html
http://www.daniweb.com/forums/post844552-30.html

It works and it is easy to implement :) ...

tux4life 2,072 Postaholic

Actually this:

outputFile<<"Name: "<<Pname<<"		"<<"Date:"<<TDate<<endl;

is the same as this:

outputFile<<"Name: "<<Pname<<"\t\t"<<"Date:"<<TDate<<endl;
tux4life 2,072 Postaholic

I forgot to say: Please post using code tags !

tux4life 2,072 Postaholic

You'll have to use Javascript to detect mouse events and keypresses within that page ...

When a mouse event and/or keypress is detected you just reset the inactivity countdown timer ...

Hope this helps ! :)

tux4life 2,072 Postaholic

I've made a graph class in wxWidgets a while back. You could have a look at it and modify it to fit you needs/

And don't post in italic-bold. It makes your posts annoying to read.

Agreed, posts in italic bold are indeed very annoying to read ...

tux4life 2,072 Postaholic

I haven't tested this on Vista, but it's working on Windows 2000/XP:
There's a cheat in minesweeper to activate a pixel in the top left corner of your screen, when you move your mouse over the mine field the pixel will become black if there's a mine, otherwise the pixel will be white ...

Enough talking, let's try the cheat:
Type xyzzy and press SHIFT-ENTER, this will do the trick ...
The cheat is now activated :P

Enjoy :) :P !!

tux4life 2,072 Postaholic

I find it great you want to share your knowledge, but for me it wasn't very helpful because of the two following reasons:
-> I did already know this
-> I don't use Windows Vista

tux4life 2,072 Postaholic

Let me explain this using an example:
If we want to store number -6 as a binary value we use the two complement:
-> Assume we're working with a byte ...
-> If we set all bits of a byte to '1' we get 11111111 which corresponds with the decimal number 255 -> Now we increase the corresponding decimal value (if all bits of the binary number are set to '1') by '1' so we get 256 (255+1) -> Now we subtract 6 from 256: 256-6 = 250 (this is the two complement of '-6') ...

=> Now if we want to subtract 6 from 17 what do we do ?
-> Well, first we rewrite '-6' as it's two complement as described above ...
-> Since 17-6 is actually the same as 17+ -6 , we can rewrite this expression using the two-complement: 17+250
-> If we make the addition of 17 and 250 the result is equal to 267 (17+250) which corresponds with 100001011 in binary ...
-> Now we just throw away the first bit and what we keep is the following: (1)00001011 which corresponds with the decimal number 11 and that's the exact result of 17-6 :) ...
The (1) in (1)00001011 is the indication of the bit we threw away ...

Hope this helps !

tux4life 2,072 Postaholic

read the Wikipedia page too. There may be something new to get there too.
http://en.wikipedia.org/wiki/Singleton_pattern

I'd already posted a link to that Wikipedia page look:

I also found a good Wikipedia description of singleton here ...

;)

tux4life 2,072 Postaholic

To the OP: #include <mynamespace.h> has to be #include "mynamespace.h" (you've to change it everywhere in your code unless 'mynamespace.h' is in your compiler's directory of include files, but I think that isn't the case)

in A.h void setX() { x=1 } has to be void setX() {x=1;} int getX() { return x} has to be int getX() {return x;} in B.h int getX() { return x} has to be int getX() {return x;} in your main program #include <A.h> #include <B.h> has to be #include "A.h" #include "B.h" (unless these header files are in your compiler's directory of include files, but I think that isn't the case)

But as already mentioned you haven't access to a compiler to test this :) ...

tux4life 2,072 Postaholic

What a crap this code is ?
60% of your code is full of bugs ...

Read your textbook first !

By the way, in future post using code tags ...

tux4life 2,072 Postaholic

I you want to draw a graph on the screen, you could simply make use of a graphics library (for instance Allegro, actually a game library but it supports simple operations like drawing lines (what you need if you want to draw a graph)) ...

On the other hand, you could take a look at William's post, but if it has to be platform independent you could make use of wxWidgets (which also supports some draw operations) or maybe even SDL ...

If you were more specific we could give you better answers to your question ...

Edit:: Allegro is also platform independent ...

tux4life 2,072 Postaholic

I've found an example on Wikipedia but the information was in Dutch, so I've translated the comments in the code:

Singleton pattern in C++

.h file

class CSingleton {
    protected: 
             CSingleton();
    public:
             virtual ~CSingleton();
             static CSingleton* Instance();
    private:
             static CSingleton* m_pSingleton;
};

.cpp file

//Define static to prevent from getting linker errors
CSingleton* CSingleton::m_pSingleton = NULL;
 
CSingleton::CSingleton() { }
CSingleton::~CSingleton() { }
 
CSingleton* CSingleton::Instance()
{
    if(m_pSingleton == NULL)
       m_pSingleton = new CSingleton;
 
    return m_pSingleton;
}

Hope this helps ! :)

Edit:: I also found a good Wikipedia description of singleton here ...

tux4life 2,072 Postaholic

when will simple::~simple() be called? after the execution of main finishes?

When the execution of main finishes, just before the program exits the destructor will be called ...

tux4life 2,072 Postaholic

Hi
I can't understand.Please explain it.

g++ -o a.out obfile.o -lmylib.a > Well, let's start with the beginning: g++ is the C++ compiler ...
> The -o specifies that a.out is the output file (this is actually the executable file)
> [U]obfile[/U].o is the object file (from your main program) which you did already compile ...
> -l[U]mylib[/U].a is your static library you're linking to your program ...

Maybe you also might want to read this tutorial about g++ ...

Hope this helps ! :)

Edit:: You have to replace obfile and mylib with the filenames of the files you're compiling ...

tux4life 2,072 Postaholic

an example in a program would be somtin like:

What would the example look like ? :)

tux4life 2,072 Postaholic

Shabtai, could you please post using code tags ?

tux4life 2,072 Postaholic

Mark this tread as solved :P

Actually the OP has to decide whether his problem is solved or not, you don't have to do this for him ...

tux4life 2,072 Postaholic

No, in that case it's likely to use another datatype ...

The following links might help you:
http://www.nongnu.org/hpalib/
http://www.apfloat.org/apfloat/ (I think this is the best :))

If you want more information on this topic you can always try searching Google for 'C++ high precision' or something ...

tux4life 2,072 Postaholic

simple::~simple is a destructor and is called automatically when the object is being destructed, you can never call it yourself ...

tux4life 2,072 Postaholic

why not something like cc -o a.out obfile.o -lmylib.a

That should do the trick, if I'm not wrong the following also works: g++ -o a.out obfile.o -lmylib.a

tux4life 2,072 Postaholic

How many times are you planning to post this code ?
I've already seen variations of this code in at least three different threads, but all with a similar question: "This code isn't compiling ..."

I'm not blaming you for this because it's a moderator's task to make a judgment about whether this is allowed or not ...

tux4life 2,072 Postaholic

In that case it's actually very logic the while loop is never running: while (X2 == 0.0f) The syntax of a while statment: while([U]condition[/U]) So when condition is true the code in the loop is run, but since X2 has the value '0.5' and since 0.5 == 0.0 results in a false the loop is never run as a result ...

tux4life 2,072 Postaholic

You could take a look here and here and ...

tux4life 2,072 Postaholic

To the OP:
-> Did you ever read a book about operating system design ?
-> How would you rate your C++ skills ?
(newbie - novice - advanced - expert)


If the answer to the first question is no and you aren't very good at C++, I think it would be better to just give up your project ...

(But ... maybe you should take a look at NewOS, it hasn't yet a Graphical Interface, but it has a Window Manager if I'm not wrong)
I think NewOS is the Operating System to learn from, compact and understandable code, if you're an advanced C++ programmer it should be no problem ...

tux4life 2,072 Postaholic

check and recheck file name spelling.

Yeah, indeed, you should recheck the spelling as it's working with me ...

tux4life 2,072 Postaholic

How much of your OS is finished? If you're asking about the GUI you must at least have finished the kernel and a command-line interface. Will your OS have virtual memory? Multitasking? Obviously it must have a file system. Are you writing the device drivers yourself, too? Quite a project (unless you steal most of your code from linux). The GUI is the least of your worries.

Yup, you're absolutely right !!

But I just find it strange: He can write a kernel, but programming a Graphical Interface is too difficult ...

tux4life 2,072 Postaholic

Do you already have a shell ? ;)
If not begin with that ...

tux4life 2,072 Postaholic

Unbeatable wants

48,
4+8=12;//SUM OF DIGITS
12%2=0// even

Agreed with what you're saying, I also want that, but my problem is that Unbeatable explained this in a very strange way ...

tux4life 2,072 Postaholic

just because the ASCII value of '0' modulo 2 is 0.

Agreed, but that's logic: 48 modulo 2 is equal to 0 ...

We're interested to know if the number's sum of digits is even or odd

Agreed.

or in other words: if it's 0 (modulo 2) or 1 (modulo 2) respectively.

You'll have to explain this carefully using an example ...

tux4life 2,072 Postaholic

Guys instead of USING AN ARPHODOX method to solve your conversion from char to numerical. Why dont you use the atoi() function built in. That way you will not need to care abt any format.

string a;
unsigned short int Sum=0,i;
a="12522";
for(i=0;i<a.length();i++)
{
string b;
b=a[i];
 Sum+=atoi(b.c_str())];
}

Yeah, but with atoi you're again doing conversions, which means it's not the most efficient way ...

tux4life 2,072 Postaholic

SOUNDS LIKE MISSION IMPOSSIBLE.

This will self destruct in 5-4-3-2-1 BOOM!!! :)

Haha :P, I actually don't understand why it's that important, he could simply display a message and close the program ...

tux4life 2,072 Postaholic

The result is the same.

Both programs were intended to calculate the sum of the digits of a number, however, the second program's output is different, try it !:angry:

tux4life 2,072 Postaholic

As already proposed it might be easier to use sessions ...

tux4life 2,072 Postaholic

Create a file called Proj4_input.txt in the same directory where the executable file is in ...

tux4life 2,072 Postaholic

You can try if you don't believe me but this code:

#include <iostream>

using namespace std;

int main()
{
	unsigned short int a,Sum=0;
	a=12522;
	while(a)
	{
		Sum+=a%10;
		a/=10;
	}
	cout << Sum << endl;
}

Has another output than this code:

#include <iostream>

using namespace std;

int main()
{
	string a;
	unsigned short int Sum=0,i;
	a="12522";
	for(i=0;i<a.length();i++) Sum+=a[i];
	cout << Sum << endl;
}

Convinced ?