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.

Recommended Answers

All 26 Replies

Slightly mincing the order...

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.

Welcome!

First problem, is the max number able to be genorated in C++ 2,147,483,647?? I read this in a tutorial...

Well, that tutorial should have said this was a platform-specific limitation, not one of the language, but that's splitting hairs.

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.

I applaud that attitude, it is all too infrequent.

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.

Perhaps consider adding zeros to a string.

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 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.

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.

Slightly mincing the order...
I applaud that attitude, it is all too infrequent.

Haha, Yeah, Well unlike alot of people I know, I love to learn!

Perhaps consider adding zeros to a string.

Is there a tutorial anywhere where I can learn how to do this?

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.

Well, I am using Visual C++, So its not that hard, but I know what I'm doing with the forms. Infact, I think I know how to input it into the rich text box.

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.

#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
*/

[edit]For amusement, a small change.

#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;
}
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?

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.

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 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

Well, I finaly got it working with 64bit int

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

unsigned int X = 10;
            unsigned _int64 Y = 10

And

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?

@Wreef
Did you include <string>?

@Wreef
Did you include <string>?

When ever I include string I get 100's of errors :(

Post your code here

#include"About.h"
//#include "string.h"
#pragmaonce
unsigned int X = 10;
unsigned _int64 Y = 10;
//String str1(1);
//String str2(0);
//String s = (1);
//s.append("0");
//int X = String::Length - 1
//using namespace STD;
//string my_string;
//String::
namespace Googolplex {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::MenuStrip^ menuStrip1;
protected: 
private: System::Windows::Forms::ToolStripMenuItem^ fileToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ helpToolStripMenuItem;
private: System::Windows::Forms::StatusStrip^ statusStrip1;
private: System::Windows::Forms::ToolStripStatusLabel^ toolStripStatusLabel1;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::Label^ label4;
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::Button^ button2;
private: System::Windows::Forms::ToolStripMenuItem^ exportNumberToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ quitToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ aboutToolStripMenuItem;
private: System::Windows::Forms::TabControl^ tabControl1;
private: System::Windows::Forms::TabPage^ tabPage1;
private: System::Windows::Forms::RichTextBox^ richTextBox1;
private: System::Windows::Forms::TabPage^ tabPage2;
private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator1;
private: System::Windows::Forms::RichTextBox^ richTextBox2;
private: System::Windows::Forms::SaveFileDialog^ saveFileDialog1;
private: System::Windows::Forms::ToolStripMenuItem^ realNumberToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ indexFormToolStripMenuItem;
private: System::Windows::Forms::SaveFileDialog^ saveFileDialog2;
 
 
 
private: 
 
 
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragmaregion Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
this->fileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->exportNumberToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->realNumberToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->indexFormToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->toolStripSeparator1 = (gcnew System::Windows::Forms::ToolStripSeparator());
this->quitToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->helpToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->aboutToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->statusStrip1 = (gcnew System::Windows::Forms::StatusStrip());
this->toolStripStatusLabel1 = (gcnew System::Windows::Forms::ToolStripStatusLabel());
this->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->label3 = (gcnew System::Windows::Forms::Label());
this->label4 = (gcnew System::Windows::Forms::Label());
this->button1 = (gcnew System::Windows::Forms::Button());
this->button2 = (gcnew System::Windows::Forms::Button());
this->tabControl1 = (gcnew System::Windows::Forms::TabControl());
this->tabPage1 = (gcnew System::Windows::Forms::TabPage());
this->richTextBox1 = (gcnew System::Windows::Forms::RichTextBox());
this->tabPage2 = (gcnew System::Windows::Forms::TabPage());
this->richTextBox2 = (gcnew System::Windows::Forms::RichTextBox());
this->saveFileDialog1 = (gcnew System::Windows::Forms::SaveFileDialog());
this->saveFileDialog2 = (gcnew System::Windows::Forms::SaveFileDialog());
this->menuStrip1->SuspendLayout();
this->statusStrip1->SuspendLayout();
this->tabControl1->SuspendLayout();
this->tabPage1->SuspendLayout();
this->tabPage2->SuspendLayout();
this->SuspendLayout();
// 
// menuStrip1
// 
this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->fileToolStripMenuItem, 
this->helpToolStripMenuItem});
this->menuStrip1->Location = System::Drawing::Point(0, 0);
this->menuStrip1->Name = L"menuStrip1";
this->menuStrip1->Size = System::Drawing::Size(422, 24);
this->menuStrip1->TabIndex = 0;
this->menuStrip1->Text = L"menuStrip1";
// 
// fileToolStripMenuItem
// 
this->fileToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(3) {this->exportNumberToolStripMenuItem, 
this->toolStripSeparator1, this->quitToolStripMenuItem});
this->fileToolStripMenuItem->Name = L"fileToolStripMenuItem";
this->fileToolStripMenuItem->Size = System::Drawing::Size(35, 20);
this->fileToolStripMenuItem->Text = L"File";
// 
// exportNumberToolStripMenuItem
// 
this->exportNumberToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->realNumberToolStripMenuItem, 
this->indexFormToolStripMenuItem});
this->exportNumberToolStripMenuItem->Name = L"exportNumberToolStripMenuItem";
this->exportNumberToolStripMenuItem->Size = System::Drawing::Size(157, 22);
this->exportNumberToolStripMenuItem->Text = L"Export Number";
this->exportNumberToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::exportNumberToolStripMenuItem_Click);
// 
// realNumberToolStripMenuItem
// 
this->realNumberToolStripMenuItem->Name = L"realNumberToolStripMenuItem";
this->realNumberToolStripMenuItem->Size = System::Drawing::Size(146, 22);
this->realNumberToolStripMenuItem->Text = L"Real Number";
this->realNumberToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::realNumberToolStripMenuItem_Click);
// 
// indexFormToolStripMenuItem
// 
this->indexFormToolStripMenuItem->Name = L"indexFormToolStripMenuItem";
this->indexFormToolStripMenuItem->Size = System::Drawing::Size(146, 22);
this->indexFormToolStripMenuItem->Text = L"Index Form";
this->indexFormToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::indexFormToolStripMenuItem_Click);
// 
// toolStripSeparator1
// 
this->toolStripSeparator1->Name = L"toolStripSeparator1";
this->toolStripSeparator1->Size = System::Drawing::Size(154, 6);
// 
// quitToolStripMenuItem
// 
this->quitToolStripMenuItem->Name = L"quitToolStripMenuItem";
this->quitToolStripMenuItem->Size = System::Drawing::Size(157, 22);
this->quitToolStripMenuItem->Text = L"Quit";
this->quitToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::quitToolStripMenuItem_Click);
// 
// helpToolStripMenuItem
// 
this->helpToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) {this->aboutToolStripMenuItem});
this->helpToolStripMenuItem->Name = L"helpToolStripMenuItem";
this->helpToolStripMenuItem->Size = System::Drawing::Size(40, 20);
this->helpToolStripMenuItem->Text = L"Help";
// 
// aboutToolStripMenuItem
// 
this->aboutToolStripMenuItem->Name = L"aboutToolStripMenuItem";
this->aboutToolStripMenuItem->Size = System::Drawing::Size(114, 22);
this->aboutToolStripMenuItem->Text = L"About";
this->aboutToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::aboutToolStripMenuItem_Click);
// 
// statusStrip1
// 
this->statusStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) {this->toolStripStatusLabel1});
this->statusStrip1->Location = System::Drawing::Point(0, 364);
this->statusStrip1->Name = L"statusStrip1";
this->statusStrip1->Size = System::Drawing::Size(422, 22);
this->statusStrip1->TabIndex = 1;
this->statusStrip1->Text = L"statusStrip1";
// 
// toolStripStatusLabel1
// 
this->toolStripStatusLabel1->Name = L"toolStripStatusLabel1";
this->toolStripStatusLabel1->Size = System::Drawing::Size(66, 17);
this->toolStripStatusLabel1->Text = L"Not Running";
// 
// label1
// 
this->label1->AutoSize = true;
this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 15, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
static_cast<System::Byte>(0)));
this->label1->Location = System::Drawing::Point(96, 47);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(223, 25);
this->label1->TabIndex = 2;
this->label1->Text = L"Googolplex Genorator";
// 
// label2
// 
this->label2->AutoSize = true;
this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 15, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
static_cast<System::Byte>(0)));
this->label2->Location = System::Drawing::Point(96, 119);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(34, 25);
this->label2->TabIndex = 3;
this->label2->Text = L"10";
// 
// label3
// 
this->label3->AutoSize = true;
this->label3->Location = System::Drawing::Point(123, 107);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(19, 13);
this->label3->TabIndex = 4;
this->label3->Text = L"10";
// 
// label4
// 
this->label4->AutoSize = true;
this->label4->Location = System::Drawing::Point(136, 93);
this->label4->Name = L"label4";
this->label4->Size = System::Drawing::Size(25, 13);
this->label4->TabIndex = 5;
this->label4->Text = L"100";
// 
// button1
// 
this->button1->Location = System::Drawing::Point(207, 108);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(54, 36);
this->button1->TabIndex = 6;
this->button1->Text = L"Start";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
// 
// button2
// 
this->button2->Location = System::Drawing::Point(267, 107);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(52, 36);
this->button2->TabIndex = 8;
this->button2->Text = L"Stop";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
// 
// tabControl1
// 
this->tabControl1->Controls->Add(this->tabPage1);
this->tabControl1->Controls->Add(this->tabPage2);
this->tabControl1->Location = System::Drawing::Point(0, 147);
this->tabControl1->Name = L"tabControl1";
this->tabControl1->SelectedIndex = 0;
this->tabControl1->Size = System::Drawing::Size(421, 217);
this->tabControl1->TabIndex = 9;
// 
// tabPage1
// 
this->tabPage1->Controls->Add(this->richTextBox1);
this->tabPage1->Location = System::Drawing::Point(4, 22);
this->tabPage1->Name = L"tabPage1";
this->tabPage1->Padding = System::Windows::Forms::Padding(3);
this->tabPage1->Size = System::Drawing::Size(413, 191);
this->tabPage1->TabIndex = 0;
this->tabPage1->Text = L"Real Number Form";
this->tabPage1->UseVisualStyleBackColor = true;
// 
// richTextBox1
// 
this->richTextBox1->BackColor = System::Drawing::SystemColors::Window;
this->richTextBox1->Location = System::Drawing::Point(2, 2);
this->richTextBox1->Name = L"richTextBox1";
this->richTextBox1->ReadOnly = true;
this->richTextBox1->Size = System::Drawing::Size(408, 183);
this->richTextBox1->TabIndex = 0;
this->richTextBox1->Text = L"";
this->richTextBox1->TextChanged += gcnew System::EventHandler(this, &Form1::richTextBox1_TextChanged);
// 
// tabPage2
// 
this->tabPage2->Controls->Add(this->richTextBox2);
this->tabPage2->Location = System::Drawing::Point(4, 22);
this->tabPage2->Name = L"tabPage2";
this->tabPage2->Padding = System::Windows::Forms::Padding(3);
this->tabPage2->Size = System::Drawing::Size(413, 191);
this->tabPage2->TabIndex = 1;
this->tabPage2->Text = L"Index Form";
this->tabPage2->UseVisualStyleBackColor = true;
// 
// richTextBox2
// 
this->richTextBox2->BackColor = System::Drawing::SystemColors::Window;
this->richTextBox2->Location = System::Drawing::Point(2, 2);
this->richTextBox2->Name = L"richTextBox2";
this->richTextBox2->ReadOnly = true;
this->richTextBox2->Size = System::Drawing::Size(408, 183);
this->richTextBox2->TabIndex = 0;
this->richTextBox2->Text = L"";
// 
// saveFileDialog1
// 
this->saveFileDialog1->DefaultExt = L"rtf";
this->saveFileDialog1->FileName = L"10";
this->saveFileDialog1->Filter = L"*.rtf|All files";
this->saveFileDialog1->Title = L"Export Number";
this->saveFileDialog1->FileOk += gcnew System::ComponentModel::CancelEventHandler(this, &Form1::saveFileDialog1_FileOk);
// 
// saveFileDialog2
// 
this->saveFileDialog2->DefaultExt = L"rtf";
this->saveFileDialog2->FileName = L"10";
this->saveFileDialog2->Filter = L"*.rtf|All files";
this->saveFileDialog2->Title = L"Export Number";
this->saveFileDialog2->FileOk += gcnew System::ComponentModel::CancelEventHandler(this, &Form1::saveFileDialog2_FileOk);
// 
// Form1
// 
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->AutoSize = true;
this->ClientSize = System::Drawing::Size(422, 386);
this->Controls->Add(this->tabControl1);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->Controls->Add(this->label4);
this->Controls->Add(this->label3);
this->Controls->Add(this->label2);
this->Controls->Add(this->label1);
this->Controls->Add(this->statusStrip1);
this->Controls->Add(this->menuStrip1);
this->MainMenuStrip = this->menuStrip1;
this->Name = L"Form1";
this->Text = L"Googolplex";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->menuStrip1->ResumeLayout(false);
this->menuStrip1->PerformLayout();
this->statusStrip1->ResumeLayout(false);
this->statusStrip1->PerformLayout();
this->tabControl1->ResumeLayout(false);
this->tabPage1->ResumeLayout(false);
this->tabPage2->ResumeLayout(false);
this->ResumeLayout(false);
this->PerformLayout();
}
#pragmaendregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
this->toolStripStatusLabel1->Text = L"Running";
this->richTextBox1->Text = L"";
this->richTextBox2->Text = L"";
if ( this->toolStripStatusLabel1->Text == "Running" ) {
Y = X * Y;
this->richTextBox1->Text = Convert::ToString(Y);
 
}
else {
 
}
// this->richTextBox1->Text = "CurrentNumber";
//
// int CurrentNumber = 10;
//
// CurrentNumber = CurrentNumber * 10;

}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
this->toolStripStatusLabel1->Text = L"Not Running"; 
 
}
private: System::Void quitToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
Application::Exit();
}
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void aboutToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
 
Form::ShowDialog(gcnew About());
 
// Application::OpenForms(About);
// Application::OpenForms("About");
}
 
private: System::Void exportNumberToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
 
}
private: System::Void saveFileDialog1_FileOk(System::Object^ sender, System::ComponentModel::CancelEventArgs^ e) {
this->richTextBox1->SaveFile(this->saveFileDialog1->FileName);
}
private: System::Void realNumberToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
this->saveFileDialog1->ShowDialog();
}
private: System::Void saveFileDialog2_FileOk(System::Object^ sender, System::ComponentModel::CancelEventArgs^ e) {
this->richTextBox2->SaveFile(this->saveFileDialog1->FileName);
}
private: System::Void indexFormToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
this->saveFileDialog2->ShowDialog();
}
private: System::Void richTextBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {
 
// this->richTextBox1->Text = Y ;
}
};
}

That is my Form1.H file, Alot of things are commented, where I havn't deleted it, just got rid of it so it would compile.

When ever I include string I get 100's of errors :(

Are you using namespace std ?

Are you using namespace std ?

Error 1 error C2871: 'STD' : a namespace with this name does not exist c:\documents and settings\brendan\my documents\visual studio 2005\projects\play\googolplex\googolplex\Form1.h 12

Error 1 error C2871: 'STD' : a namespace with this name does not exist c:\documents and settings\brendan\my documents\visual studio 2005\projects\play\googolplex\googolplex\Form1.h 12

C and C++ are case sensitive. STD is not std ; String is not string .

C and C++ are case sensitive. STD is not std .

Same error...

Error 1 error C2871: 'std' : a namespace with this name does not exist c:\documents and settings\brendan\my documents\visual studio 2005\projects\play\googolplex\googolplex\Form1.h 12

So you do this kinda stuff?

#include <string>
using namespace std;
// ...
string str("1");

I can't see what's in your "About.h", or know exactly what you are changing, unless you post it.

About.h is just another form, which has/will have information about the program.

#pragma once
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
 
namespace Googolplex {
/// <summary>
/// Summary for About
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
/// </summary>
public ref class About : public System::Windows::Forms::Form
{
public:
About(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~About()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::TextBox^ textBox1;
protected: 
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->SuspendLayout();
// 
// label1
// 
this->label1->AutoSize = true;
this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
static_cast<System::Byte>(0)));
this->label1->Location = System::Drawing::Point(12, 9);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(201, 31);
this->label1->TabIndex = 0;
this->label1->Text = L"Raving Insanity";
this->label1->TextAlign = System::Drawing::ContentAlignment::TopCenter;
// 
// label2
// 
this->label2->AutoSize = true;
this->label2->Location = System::Drawing::Point(15, 49);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(127, 13);
this->label2->TabIndex = 1;
this->label2->Text = L"www.RavingInsanity.com";
// 
// textBox1
// 
this->textBox1->Location = System::Drawing::Point(12, 78);
this->textBox1->Multiline = true;
this->textBox1->Name = L"textBox1";
this->textBox1->ReadOnly = true;
this->textBox1->Size = System::Drawing::Size(318, 80);
this->textBox1->TabIndex = 2;
this->textBox1->Text = L"This program was created by Brendan Wreford. This program was intended for no pro" 
L"fit and may not be resold.";
this->textBox1->TextChanged += gcnew System::EventHandler(this, &About::textBox1_TextChanged);
// 
// About
// 
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(533, 206);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->label2);
this->Controls->Add(this->label1);
this->Name = L"About";
this->Text = L"About";
this->TopMost = true;
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {
}
};
}

Also, Nearly all my errors when I include string are comming from stdio.h

I'm not sure if it gives up before it gets to it, or if it works, but when "string" is included, I don't see the std errors.

About.h is just another form, which has/will have information about the program.

Without it, I can't compile your code, so it is best to post all code you see.

#pragma once
using namespace System;
using namespace System::ComponentModel;

Whatever colorizer you are using appears to be eating spaces, so I can't just copy and paste it without syntax errors too.

If you're using the whole namespace, why then grab specific parts?

To be honest, I'm not that familiar with CLI, so my input is going to be limited with that area.

Also, Nearly all my errors when I include string are comming from stdio.h

I'm not sure if it gives up before it gets to it, or if it works, but when "string" is included, I don't see the std errors.

You are mixing C, C++, and CLI as well -- no wonder it's confusing. There are differences between <string.h>, <string>, and <cstring>.

[edit]Why not post a link to where you got the base of this code as well.

I kinda meant the other 95% of your code which isn't standard C++.

Most of my code, I worked out myself, and got some help from the chat room, some of it from tutorials,

Anyway, I zipped my whole project folder up, so you can have a look.

http://ravinginsanity.com/googolplex.zip

Thanks for the help :cheesy:

Member Avatar for iamthwee

You've gotta horrendous coding style developing there. Yikes!

You are mixing C, C++, and CLI as well

My advice would be to stop before you get worse. Ha ha. Why don't you look into the .net framework if you are interested in writing GUIs or pick up java?

You've gotta horrendous coding style developing there. Yikes!


My advice would be to stop before you get worse. Ha ha. Why don't you look into the .net framework if you are interested in writing GUIs or pick up java?

Haha, I have basicly been coding since Saturday :P

I plan on doing it properly soon, I just want to get this finished :P

Why should I pick up Java? I thought that was bad for having a GUI.

Member Avatar for iamthwee

> Haha, I have basicly been coding since Saturday :P

Oh dear, looks like ur trying to run before you can crawl.

> I plan on doing it properly soon, I just want to get this finished :P

Another bad idea, do it properly from the beginning otherwise you could be inviting problems later on.

>Why should I pick up Java? I thought that was bad for having a GUI.

Java is excellent for GUI building.

I know a person who is a programmer for a living, and there telling me to do C#, but thats another story :P

Anyway, I don't think these faults are in my code...I made a new project, and tested it, a blank form came up, then included <string> and got the same errors.

Well, After heaps of trying to get this to work, I decided to rebuild this in C#

I have almost got everything working, even got strings working, I just can't get it to keep adding 0's.

So I'll post a topic in the C# section.

Thanks for everyones help.

commented: Dumb +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.