Jump to content

Rick Malik

Members
  • Content Count

    4
  • Joined

  • Last visited

Everything posted by Rick Malik

  1. Rick Malik

    vsspell ocx and how to use it?

    Stack Overflow [closed] my question because they thought I was looking for books, software, or tutorials.... Maybe I am (looking for "show me how").... I just wanna know what to do with BadWordFound so I can replace the stupid thing in my TMemo when it finds it. There's plenty of VB and pascal examples, but I only speak c/c++. A simple line or two to follow my "VSSpell1->CheckText = MailMemo->Text;" would be useful.... Thanks
  2. Rick Malik

    I keep being off by one

    Pretty funny how you react to this stuff.... BTW, your code wouldn't compile . Here are the errors from the compiler: Build [C++ Error] Unit1.cpp(28): E2268 Call to undefined function '_D' [C++ Error] Unit1.cpp(30): E2015 Ambiguity between '_fastcall System::operator +(int,const System::Variant &)' and '_fastcall System::operator +(int,const System::Currency &)' [C++ Error] Unit1.cpp(38): E2015 Ambiguity between '_fastcall System::operator +(int,const System::Variant &)' and '_fastcall System::operator +(int,const System::Currency &)' [C++ Warning] Unit1.cpp(55): W8070 Function should return a value So why num and nums are in the header is so they wouldn't fall out of scope, as I placed them under a second button. This time they both came out zeros(?) And I didn't try to rewrite his method, I simply removed the couts so I could just run the function(). But thanks for your input. It was more than enlightening. //---------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { int i, nums[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; for(i = 0; i < 10; i++) square(nums, 10); for(i = 0; i < 10; i++) return ; } //--------------------------------------------------- int __stdcall TForm1:: square(int *n, int num) { while(num) { *n = *n * *n; num--; n++; } return num; } //---------------------------------------------------- void __fastcall TForm1::Button2Click(TObject *Sender) { Label1->Caption = IntToStr(nums); Label2->Caption = IntToStr(num); }
  3. Rick Malik

    I keep being off by one

    Okay so I tried this I put this in the .h int nums,num; int __stdcall square(int *n, int num); and this in the .cpp void __fastcall TForm1::Button1Click(TObject *Sender) { int i, nums[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; for(i = 0; i < 10; i++) square(nums, 10); for(i = 0; i < 10; i++) Label1->Caption = IntToStr(nums); return ; } //--------------------------------------------------------------------------- int __stdcall TForm1:: square(int *n, int num) { while(num) { *n = *n * *n; num--; n++; } Label2->Caption = IntToStr(num); } Label1 says 1 Label2 says 0 am I doing this right?
  4. Rick Malik

    I keep being off by one

    But aren't there 11 nums? 0 thru 10 = 11
×