Jump to content

357mag

Members
  • Content Count

    66
  • Joined

  • Last visited

Everything posted by 357mag

  1. 357mag

    How many people use Delphi?

    I have not really dived into Delphi but it looks like a cool language to learn. I do have some books on it. My question is if you had to guess, is Delphi widely used, or is it kinda dead as a language?
  2. 357mag

    Why Should a C-Sharper Learn Delphi?

    I would say that just because the same man wrote both languages does not make them similar. Delphi is definitely different than C#. C# is easier to grasp than Delphi is.
  3. I thought in Delphi there was end; with a semicolon And end. with a period But I have seen a third end That one has nothing after the keyword What's going on?
  4. I remember back around 1997 or so when I was working with Microsoft Visual Basic 6 I wanted to try their other product, Visual C++ 6. But when I looked at some of the code it looked like a scary nightmare. I guess I was expecting it to look kinda like standard C++ but it looked way different with all kinds of different terminology and it was way over my head. Right around the same time I found out about this product called Borland C++ 4 Standard so I bought that and just made console programs with it. I'd like to ask you guys if you have worked with Microsoft's Visual C++. Did you like it or hate it?
  5. 357mag

    Have any of you worked with Visual C++?

    I like console programming. But I also like beginning Windows programming which is what I have already started using C# and C++ Builder. One of the more adventourous programs I would like to build is a 10 question music test or a 10 question psychology test. I want it to ask a question and then the user will give his answer to the question and then hit the Next button and the next question appears. It will be multiple choice so I will be using radio buttons I imagine. I'm wondering if I would need to use 10 different forms to represent the 10 questions, or is there a way to to continue to use just one form for all 10 questions. I like bouncing around too between languages. Microsoft Visual C++ when I found out what it was like turned me off, but I have often looked into it again but each time I say No Thanks. Curiosity.
  6. 357mag

    Have any of you worked with Visual C++?

    The Visual in Visual Basic or Visual C++ or Visual C# simply means you can make a Graphical Interface with it. You're working in a visual manner instead of in a console manner (although you can do that too).
  7. 357mag

    Have any of you worked with Visual C++?

    No Visual C++ as it comes in Visual Studio and when it was available as a separate product in a box called Visual C++ 6. It was MFC which looked very difficult to monkey with or learn. Now we have WPF and WinForms so maybe it's not so bad. But I don't think Microsoft really wants programmers to use it. They are pushing Visual C#.
  8. I need to convert a number (which I think defaults to a string) to an integer in C++ Builder: void __fastcall TForm1::Button1Click(TObject *Sender) { int x; int y; int sum; x = std::stoi (Edit1->Text); y = Edit2->Text; sum = x = y; Label3->Caption = "The sum is" + sum;
  9. In order not to piss anyone off on the forum, I will change my code to the C++ Builder string type.
  10. I've got a program where the user enters his first name in an Edit box. Then he presses the button entitled Show Message and I will show him a Welcome Message. I'm having some trouble with coding the first name. Builder says Could not find a match for string::basic(const string&). Here is what I have so far: #include <vcl.h> #pragma hdrstop #include "welcome_program.h" #include <iostream> #include <string> using namespace std; //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TFormWelcome *FormWelcome; //--------------------------------------------------------------------------- __fastcall TFormWelcome::TFormWelcome(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TFormWelcome::ButtonShowMessageClick(TObject *Sender) { string firstName = AnsiString(EditFirstName->Text); }
  11. 357mag

    Need a little help with my Welcome Program

    I got it going! This works: #include <vcl.h> #pragma hdrstop #include "welcome_program.h" #include <iostream> //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TFormWelcome *FormWelcome; //--------------------------------------------------------------------------- __fastcall TFormWelcome::TFormWelcome(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TFormWelcome::ButtonShowMessageClick(TObject *Sender) { AnsiString firstName = EditFirstName->Text; LabelMessage->Caption = "Welcome to C++ Programming " + firstName + "!"; }
  12. I added Ansistring(sum) and it worked.
  13. Well I think I got part of it going. y = Edit2->Text.ToInt(); I think that is okay, but the answer in the Label just says "is". I think I got the same problem going on. Pointer arithmetic or something. I'll have to mess with it.
  14. 357mag

    I would like blue not black

    I've got a simple Welcome Message program and when I click the Show Message button it prints a "Welcome to C++ Builder!" message in a label. Only thing that's not going quite right is I would like the text of the message to print in blue, not black. I've got the label selected and I'm going into the color property and choosing clNavy. But when I run the program the Welcome message still prints in black.
  15. 357mag

    I would like blue not black

    It works! Thank You So Much.
  16. 357mag

    Question about formatting

    I've wondered if I should do this: EditPrompt->Text or this by adding some whitespace: EditPrompt -> Text How do you guys do it or is there a convention?
  17. 357mag

    Confused on two things

    I can't post the code at the moment, but I wrote a program that inputs a number and then it determines if the number is odd or even. I used a if-else structure. At the end of the code I put and end(with a semi-colon), and immediately after that I put an end(with a period). The compiler complained. It said "expected a . but got a ; instead. I thought you were supposed to use begin and end(with a semi-colon) kind of like an opening brace and a closing brace in other languages. But I had to completely remove the end(with the semi-colon) to get rid of that error. I don't understand why. And then I had a semi-colon on the statement right before the else. Then I find out by reading that you don't do that either. No semi-colon there.
  18. 357mag

    Confused on two things

    This code is the corrected version: var x: integer; begin Write('Enter an integer: '); ReadLn(x); if (x mod 2 = 0) then WriteLn('The number is even') else WriteLn('The number is odd'); WriteLn; Write('Press Enter to quit...'); ReadLn; end.
  19. 357mag

    Confused on two things

    This code is the incorrect version. This is the version I first came up with: var x: integer; begin Write('Enter an integer: '); ReadLn(x); if (x mod 2 = 0) then WriteLn('The number is even'); else WriteLn('The number is odd'); WriteLn; Write('Press Enter to quit...'); ReadLn; end; end.
  20. What are some of the ways I can code my console program to keep the console window open after it opens? I know in C++ I used to use getch().
  21. I've got a program that asks the user to enter a value (in an Edit box) and then when he clicks on the Show Value button, the Label should say "The value of x is " plus whatever value he entered in the Edit box. But Delphi is complaining saying "x is not a valid integer value." I don't know what's wrong with my code but here is what I've got: var FormSimpleVariable: TFormSimpleVariable; x : integer; implementation {$R *.dfm} procedure TFormSimpleVariable.ButtonQuitClick(Sender: TObject); begin Application.Terminate; end; procedure TFormSimpleVariable.ButtonShowValueClick(Sender: TObject); begin x := StrToInt('x'); LabelResult.Caption := 'The value of x is ' + IntToStr(x); end; end.
  22. 357mag

    I need the console window to stay open

    So when your program is all completed as far as writing all the code, you put an end (with a period) at the end. If you are just denoting a code block, then you put and end (with a semicolon).
  23. 357mag

    I need the console window to stay open

    Yes I was about to post that I found a way using ReadLine. I'm a little confused about the two end keywords. It seems sometimes I see end with a semicolon and that is all. Other times I see end with a period. Other times I see both in a code snippet.
  24. 357mag

    Delphi says "x is not a valid integer value"

    I don't recall adding those single quotes around x (like ('x')). Don't know what happened there. Mistakes and being human I guess.
  25. My program prompts the user to enter a character (like 'A' for example). Then I'm trying to store it in a character variable. But C++ is telling me it can't cast from Unicode string to a character. How do I handle it? My code looks like this: char ch = 0; int chValue = 0; LabelPrompt -> Caption = "Enter a character: "; ch = static_cast<char>(EditCharacterEntry -> Text); The goal of this program is to print the Ascii code for the letter the user entered. Then it would show something like 'w' is 119. 'x' is 120.
×