• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
  • About
  • Life
  • Tech
  • Travel
  • Work
  • Questions
  • Contact

Welcome

.

how do i add variables to labeledit?

April 10, 2020 by

Questions › how do i add variables to labeledit?
0
Vote Up
Vote Down
Garmaine asked 4 years ago

I need to add the variables T1, T2 so that they are read in LABELEDIT and summed up BUTTON1CLICK, but I can’t figure out how to format it correctly, as you can see I made them only with a record from the code.

it seems easy but i dull out of the blue

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1_mytime.h"
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1* Form1;

void MyTime::show()
{
    AnsiString s;
    s = IntToStr(chas) + ":" + IntToStr(min) + ":" + IntToStr(sec);
    Form1->Memo1->Lines->Add(s);
}

void MyTime::summa(MyTime t1, MyTime t2)
{
    sec = t1.sec + t2.sec;
    min = t1.min + t2.min;
    chas = t1.chas + t2.chas;
    if (sec >= 60) {
        min++;
        sec -= 60;
    }
    if (min >= 60) {
        chas++;
        min -= 60;
    }
    if (chas >= 24)
        chas = chas - 24;
}

__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}

void __fastcall TForm1::Button1Click(TObject* Sender)
{
    Memo1->Clear();
    MyTime T1(13, 23, 50), T2(10, 52, 50), T3;
    T1.show();
    T2.show();
    T3.summa(T1, T2);
    T3.show();
}

unit.h

#ifndef Unit1_mytimeH
#define Unit1_mytimeH

#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>

class TForm1 : public TForm
{
__published:    // IDE-managed Components
    TMemo *Memo1;
    TButton *Button1;
    void __fastcall Button1Click(TObject *Sender);
private:    // User declarations
public:        // User declarations
    __fastcall TForm1(TComponent* Owner);
};

   class MyTime {
   private:
    int chas;
    int min;
    int sec;
 public:
    MyTime() { chas=0; min=0; sec=0; }
    MyTime(int ch, int m, int s) {
       chas=ch; min=m; sec=s;
    }
    void show();
    void summa(MyTime t1, MyTime t2);
};

extern PACKAGE TForm1 *Form1;
#endif
Are you looking for the answer?
Original Question and Possible Answers can be found on `http://stackoverflow.com`

Question Tags: c++, c++builder, vcl

Please login or Register to submit your answer




Primary Sidebar

Tags

Advancements best Business strategies commercial convenience economic Finances Cognitive decline Financial growth firm Future Hidden Gems Home hydration Impact Innovations lighting line of work Mental health Must-See New York City office patronage Productivity profession Profitability tips Profit optimization pursuit recreation Revenue enhancement romance sippy cups social station Technological breakthroughs technology toddlers trading transaction Treasures Uncover undertaking Well-being Wonders Work Young onset dementia

Newsletter

Complete the form below, and we'll send you all the latest news.

Footer

Footer Funnies

Who knew that reading the footer could be such a hilarious adventure? As we navigate websites, books, and documents, we often stumble upon the unassuming space at the bottom, only to discover a treasure trove of amusement. In this side-splitting compilation, we present 100 jokes that celebrate the unsung hero of content – the footer. Get ready to chuckle, giggle, and maybe even snort as we dive into the world of footnotes, disclaimers, and hidden comedic gems. Brace yourself for a wild ride through the footer!

Recent

  • Unveiling the Enigma: Almost-Magical Lamp Lights Highway Turns
  • The Impact of Young Onset Dementia on Employment and Finances: Optimizing Post-Diagnostic Approaches
  • 11 Wonders of 2023 Technological Breakthrough – Unveiling the Future
  • Work from Home and Stay Mentally Sane – Achieve Productivity and Well-being
  • Hidden Gems of New York City – Uncover the Must-See Treasures!

Search

Tags

Advancements best Business strategies commercial convenience economic Finances Cognitive decline Financial growth firm Future Hidden Gems Home hydration Impact Innovations lighting line of work Mental health Must-See New York City office patronage Productivity profession Profitability tips Profit optimization pursuit recreation Revenue enhancement romance sippy cups social station Technological breakthroughs technology toddlers trading transaction Treasures Uncover undertaking Well-being Wonders Work Young onset dementia

Copyright © 2023