Scherzprogramm. Hardware Ryzen 3950 Arbeitsspeicher 64 GB Grafikkarte Radeon 5700 XT Modell GPT-OSS-20B create a c++ builder app for greeting cards Here's a C++ Builder application for creating greeting cards with a modern UI and basic functionality: ```cpp #include #pragma hdrstop #include "Unit1.h" #include // Form declaration #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } void __fastcall TForm1::Button1Click(TObject *Sender) { // Get text from input fields String greeting = Edit1->Text; String senderName = Edit2->Text; String recipientName = Edit3->Text; // Validate inputs if (greeting.IsEmpty() || senderName.IsEmpty() || recipientName.IsEmpty()) { ShowMessage("Please fill in all fields!"); return; } // Combine text for preview String finalCard = "Dear " + recipientName + ",\n\n" + greeting + "\n\n" + "With love,\n" + senderName; // Display in memo Memo1->Lines->Text = finalCard; } void __fastcall TForm1::Button2Click(TObject *Sender) { // Save card to file SaveDialog1->Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"; if (SaveDialog1->Execute()) { try { Memo1->Lines->SaveToFile(SaveDialog1->FileName); ShowMessage("Card saved successfully!"); } catch (...) { ShowMessage("Error saving file!"); } } } void __fastcall TForm1::Button3Click(TObject *Sender) { // Reset all fields Edit1->Clear(); Edit2->Clear(); Edit3->Clear(); Memo1->Clear(); } void __fastcall TForm1::FormCreate(TObject *Sender) { // Set default card styles ComboBox1->Items->Add("Birthday"); ComboBox1->Items->Add("Anniversary"); ComboBox1->Items->Add("Holiday"); ComboBox1->Items->Add("Sympathy"); ComboBox1->Items->Add("Congratulations"); ComboBox1->Items->Add("Thank You"); ComboBox1->ItemIndex = 0; // Set default text Edit1->Text = "Wishing you a wonderful day!"; Edit2->Text = "Your Name"; Edit3->Text = "Friend's Name"; } void __fastcall TForm1::ComboBox1Change(TObject *Sender) { // Change greeting based on selected card type String selectedCard = ComboBox1->Text; if (selectedCard == "Birthday") { Edit1->Text = "Happy Birthday! May your day be filled with joy and laughter!"; } else if (selectedCard == "Anniversary") { Edit1->Text = "Wishing you both a lifetime of happiness together!"; } else if (selectedCard == "Holiday") { Edit1->Text = "May your holidays be merry and bright!"; } else if (selectedCard == "Sympathy") { Edit1->Text = "Thinking of you during this difficult time."; } else if (selectedCard == "Congratulations") { Edit1->Text = "Congratulations on your amazing achievement!"; } else if (selectedCard == "Thank You") { Edit1->Text = "Thank you for all your kindness and support!"; } } ``` **Form Design (Unit1.dfm):** ```pascal object Form1: TForm1 Left = 0 Top = 0 Caption = 'Greeting Card Creator' ClientHeight = 472 ClientWidth = 635 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] OldCreateOrder = False OnCreate = FormCreate PixelsPerInch = 96 TextHeight = 13 object Label1: TLabel Left = 24 Top = 25 Width = 35 Height = 13 Caption = 'Greeting' end object Label2: TLabel Left = 24 Top = 64 Width = 70 Height = 13 Caption = 'Your Name:' end object Label3: TLabel Left = 24 Top = 104 Width = 85 Height = 13 Caption = 'Recipient Name:' end object Label4: TLabel Left = 24 Top = 144 Width = 67 Height = 13 Caption = 'Card Type:' end object Edit1: TEdit Left = 115 Top = 22 Width = 490 Height = 21 TabOrder = 0 end object Edit2: TEdit Left = 115 Top = 61 Width = 490 Height = 21 TabOrder = 1 end object Edit3: TEdit Left = 115 Top = 101 Width = 490 Height = 21 TabOrder = 2 end object ComboBox1: TComboBox Left = 115 Top = 141 Width = 145 Height = 21 Style = csDropDownList TabOrder = 3 end object Button1: TButton Left = 24 Top = 184 Width = 75 Height = 25 Caption = 'Preview' TabOrder = 4 OnClick = Button1Click end object Button2: TButton Left = 105 Top = 184 Width = 75 Height = 25 Caption = 'Save' TabOrder = 5 OnClick = Button2Click end object Button3: TButton Left = 186 Top = 184 Width = 75 Height = 25 Caption = 'Reset' TabOrder = 6 OnClick = Button3Click end object Memo1: TMemo Left = 24 Top = 224 Width = 581 Height = 230 ScrollBars = ssBoth TabOrder = 7 end object SaveDialog1: TSaveDialog Left = 320 Top = 184 end end ``` **Features of this application:** 1. **User-Friendly Interface**: - Input fields for greeting, sender name, and recipient name - Dropdown for selecting card type (Birthday, Anniversary, etc.) - Preview button to generate the final card text - Save functionality to export cards as text files - Reset button to clear all fields 2. **Card Types**: - Predefined greeting messages based on card type selection - Easy customization of standard templates 3. **Functionality**: - Input validation to ensure all fields are filled - Automatic formatting of the final card text - File saving capability with file dialog - Error handling for file operations 4. **Usage Instructions**: 1. Enter your greeting message in the "Greeting" field 2. Fill in your name as the sender 3. Enter the recipient's name 4. Select a card type from the dropdown (optional) 5. Click "Preview" to see your card 6. Use "Save" to export the card to a text file 7. Use "Reset" to clear all fields **To compile and run:** 1. Create a new VCL Forms Application in C++ Builder 2. Replace the default form code with this implementation 3. Add the required components (Edit, Label, Button, ComboBox, Memo, SaveDialog) 4. Compile and run the application The application provides a clean interface for creating personalized greeting cards with basic functionality for saving and previewing your creations.