| | |
Math Functions
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Aug 2006
Posts: 40
Reputation:
Solved Threads: 1
Hello Everyone,
This is my first post, I am very new to C++, infact only touched it once before today, so I need some help.
I am trying to genorate a big number, This number isn't actualy possible to genorate (Googolplex) but I want to program to keep multiplying itself by 10, until the stop button is pressed.
I have a rich text box set up, where I want the outputted number to go in real time.
Then, I have another rich text box (On another tab) Where, I want the index form of the number to be shown.
First problem, is the max number able to be genorated in C++ 2,147,483,647?? I read this in a tutorial...
Second, How can I output everything done in real time to a rich text box? Then, I guess I need to count the zero's and put 10^amout on zero's in the other box.
I don't want to be spoonfed, I need to learn how to use C++ so any tips/helps would be great, a point in the right direction, ect.
Thanks for your time,
Brendan.
This is my first post, I am very new to C++, infact only touched it once before today, so I need some help.
I am trying to genorate a big number, This number isn't actualy possible to genorate (Googolplex) but I want to program to keep multiplying itself by 10, until the stop button is pressed.
I have a rich text box set up, where I want the outputted number to go in real time.
Then, I have another rich text box (On another tab) Where, I want the index form of the number to be shown.
First problem, is the max number able to be genorated in C++ 2,147,483,647?? I read this in a tutorial...
Second, How can I output everything done in real time to a rich text box? Then, I guess I need to count the zero's and put 10^amout on zero's in the other box.
I don't want to be spoonfed, I need to learn how to use C++ so any tips/helps would be great, a point in the right direction, ect.
Thanks for your time,
Brendan.
Slightly mincing the order...
Welcome!
Well, that tutorial should have said this was a platform-specific limitation, not one of the language, but that's splitting hairs.
I applaud that attitude, it is all too infrequent.
Perhaps consider adding zeros to a string.
It sounds like you know some API stuff before the language proper. This make it a little more confusing trying to gauge what recommendation(s) may be at your level [API stuff is generallyl out of mine.] Perhaps you could post a minimal snippet of compileable code to help others help you.
•
•
•
•
Originally Posted by Wreef
Hello Everyone,
This is my first post, I am very new to C++, infact only touched it once before today, so I need some help.
•
•
•
•
Originally Posted by Wreef
First problem, is the max number able to be genorated in C++ 2,147,483,647?? I read this in a tutorial...
•
•
•
•
Originally Posted by Wreef
I don't want to be spoonfed, I need to learn how to use C++ so any tips/helps would be great, a point in the right direction, ect.
•
•
•
•
Originally Posted by Wreef
I am trying to genorate a big number, This number isn't actualy possible to genorate (Googolplex) but I want to program to keep multiplying itself by 10, until the stop button is pressed.
•
•
•
•
Originally Posted by Wreef
Second, How can I output everything done in real time to a rich text box? Then, I guess I need to count the zero's and put 10^amout on zero's in the other box.
•
•
•
•
Originally Posted by Wreef
I have a rich text box set up, where I want the outputted number to go in real time.
Then, I have another rich text box (On another tab) Where, I want the index form of the number to be shown.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
•
•
Join Date: Aug 2006
Posts: 40
Reputation:
Solved Threads: 1
•
•
•
•
Originally Posted by Dave Sinkula
Slightly mincing the order...
I applaud that attitude, it is all too infrequent.
•
•
•
•
Perhaps consider adding zeros to a string.
•
•
•
•
It sounds like you know some API stuff before the language proper. This make it a little more confusing trying to gauge what recommendation(s) may be at your level [API stuff is generallyl out of mine.] Perhaps you could post a minimal snippet of compileable code to help others help you.
Would it be possible for me to do X x 10, and make it so when ever that calculation is done, the answer is stored as X, and X's original value is 10?
And then count the amout of 0's in X and store it in Y?
I don't really know, as I said, just learning. Although strings sounded interesting.
Now, I don't think there is point in posting the code, because I havn't done much yet, just small things like when the button is pressed, text changes, ect (I can do that easy :p )
Here's a cheap and ugly, bargain-basement example of what I meant about using strings.
[edit]For amusement, a small change.
C++ Syntax (Toggle Plain Text)
#include <stdio.h> #include <string.h> int main ( void ) { char text[50] = {'3'}; /* a cheap way of having a starting value */ int i; for ( i = 0; i < sizeof text - 1; ++i ) { puts(text); strcat(text, "0"); } return 0; } /* my output 3 30 300 3000 30000 300000 3000000 30000000 300000000 3000000000 30000000000 300000000000 3000000000000 30000000000000 300000000000000 3000000000000000 30000000000000000 300000000000000000 3000000000000000000 30000000000000000000 300000000000000000000 3000000000000000000000 30000000000000000000000 300000000000000000000000 3000000000000000000000000 30000000000000000000000000 300000000000000000000000000 3000000000000000000000000000 30000000000000000000000000000 300000000000000000000000000000 3000000000000000000000000000000 30000000000000000000000000000000 300000000000000000000000000000000 3000000000000000000000000000000000 30000000000000000000000000000000000 300000000000000000000000000000000000 3000000000000000000000000000000000000 30000000000000000000000000000000000000 300000000000000000000000000000000000000 3000000000000000000000000000000000000000 30000000000000000000000000000000000000000 300000000000000000000000000000000000000000 3000000000000000000000000000000000000000000 30000000000000000000000000000000000000000000 300000000000000000000000000000000000000000000 3000000000000000000000000000000000000000000000 30000000000000000000000000000000000000000000000 300000000000000000000000000000000000000000000000 3000000000000000000000000000000000000000000000000 */
#include <stdio.h>
#include <string.h>
char text[1000000] = {'3'}; /* a cheap way of having a starting value */
int main ( void )
{
int i;
for ( i = 0; i < sizeof text - 1; ++i )
{
puts(text);
strcat(text, "0");
}
return 0;
} Last edited by Dave Sinkula; Aug 12th, 2006 at 1:43 am.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
•
•
Join Date: Aug 2006
Posts: 40
Reputation:
Solved Threads: 1
this->richTextBox1->Text = "CurrentNumber"; int CurrentNumber = 10; CurrentNumber = CurrentNumber * 10;
Just a thought from a n00b, I know this doesn't work, it just makes the text CurrentNumber show up...However is there a way I could make that work? So it shows the variable?
This might not work...Seems simple though.
--------------------------------------------------------------------------------------------------
Edit:
How would I impliment what you showed me, to display in a text box? Is there a way I can control where the output goes?
Last edited by Wreef; Aug 12th, 2006 at 2:17 am.
Well if you want to run the program in real time then you need to reconsider your idea since in the end you would end up seeing the final value in the text box (due to the fast execution of your program) or until you run out of buffer.
Maybe you need to implement a delay which would update the contents in the text box at regular intervals of time.
This is what i think should come, but still i would like Dave to verify this for me coz this is just the logic i think should be used.
Hope it helped, bye.
Maybe you need to implement a delay which would update the contents in the text box at regular intervals of time.
C++ Syntax (Toggle Plain Text)
char text[1000000] = {'3'}; for ( i = 0; i < sizeof text - 1; ++i ) { this->richTextBox1->Text = text; strcat(text, "0"); // some delay function }
This is what i think should come, but still i would like Dave to verify this for me coz this is just the logic i think should be used.
Hope it helped, bye.
I don't accept change; I don't deserve to live.
•
•
Join Date: Aug 2006
Posts: 40
Reputation:
Solved Threads: 1
I understand some of that code...But I always get errors when I try implimenting it.
I've made a big mess of my code, so I have started a new project, and I'm up to the same thing as I was before, I need to get the basics of this working.
In theory, would I be able to, somehow, store 10 in a variable, * by 10, override the variable with my new answer, then repeat. While at the same time my textbox is refreshing every second?
Also, another question, I seen things like "this->" leading to heaps of different things, what does this mean? I tried finding it on google, but there wasn't much help, I guess because the word "This" can be used for alot of things :p
I've made a big mess of my code, so I have started a new project, and I'm up to the same thing as I was before, I need to get the basics of this working.
In theory, would I be able to, somehow, store 10 in a variable, * by 10, override the variable with my new answer, then repeat. While at the same time my textbox is refreshing every second?
Also, another question, I seen things like "this->" leading to heaps of different things, what does this mean? I tried finding it on google, but there wasn't much help, I guess because the word "This" can be used for alot of things :p
•
•
Join Date: Aug 2006
Posts: 40
Reputation:
Solved Threads: 1
Well, I finaly got it working with 64bit int
Anyway, I need bigger, I found out the only way to do this would be strings, this will also be easier when I later go to put it in index form, as I can just count the string.
Problem, I don't know one thing about strings!
I am using Visual Studio, so C++ .net and I can't get anything to do with strings working.
string s; //Gives an error
s.append ("0") //Gives an error
Infact, anything to do with strings gives me errors, must be doing something wrong.
Can someone please help?
At the moment I'm using
And
Like I said, it works, but no more than a 18 didget number...Need strings.
Can someone help me replace the int's with strings? Explain how?
C++ Syntax (Toggle Plain Text)
unsigned int X = 10; unsigned _int64 Y = 10;
Anyway, I need bigger, I found out the only way to do this would be strings, this will also be easier when I later go to put it in index form, as I can just count the string.
Problem, I don't know one thing about strings!
I am using Visual Studio, so C++ .net and I can't get anything to do with strings working.
string s; //Gives an error
s.append ("0") //Gives an error
Infact, anything to do with strings gives me errors, must be doing something wrong.
Can someone please help?
At the moment I'm using
C++ Syntax (Toggle Plain Text)
unsigned int X = 10; unsigned _int64 Y = 10
And
C++ Syntax (Toggle Plain Text)
if ( this->toolStripStatusLabel1->Text == "Running" ) { Y = X * Y; this->richTextBox1->Text = Convert::ToString(Y);
Like I said, it works, but no more than a 18 didget number...Need strings.
Can someone help me replace the int's with strings? Explain how?
![]() |
Similar Threads
- Need help learning the loop/do while loop (C++)
- Multiple operations from 2 inputs. (Java)
- Did I write this correctly, and is there other way to writ it? (Python)
- printing meter yards feet (C++)
- Finding the Big Oh for these Math.functions (Computer Science)
- Issues using Math class (Java)
- Decimal Problem In C (C)
- missing function header (C++)
Other Threads in the C++ Forum
- Previous Thread: plz friends help me
- Next Thread: help with c++ input
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion convert count data database delete desktop developer directshow dll dynamiccharacterarray email encryption error file forms fstream function functions game generator getline google graph homeworkhelper iamthwee ifstream input int integer java lib linkedlist linux list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates text tree unix url vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






