Портал освітньо-інформаційних послуг «Студентська консультація»

  
Телефон +3 8(066) 185-39-18
Телефон +3 8(093) 202-63-01
 (093) 202-63-01
 studscon@gmail.com
 facebook.com/studcons

<script>

  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)

  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

 

  ga('create', 'UA-53007750-1', 'auto');

  ga('send', 'pageview');

 

</script>

Розробка програмного забезпечення

Тип роботи: 
Звіт з практики
К-сть сторінок: 
55
Мова: 
Українська
Оцінка: 

justify;"> 

 
Завдання 2.2
Дано ціле число, яке лежить в діпазоні 1-999. Винести його рядок – опис виду «парне двозночне число», «непарне тризначне число» і т.д.
#pragma hdrstop
#pragma argsused
#ifdef _WIN32
#include <tchar.h>
#else
  typedef char _TCHAR;
  #define _tmain main
#endif
 
#include <stdio.h>
#include "iostream.h"
 
 int _tmain(int argc, _TCHAR* argv[])
{
int num;
bool b=true;
cout<<"write number in the range from 1 to 999 \nnumber=";
cin>>num;
if((num>0)&&(num<10))
{cout<<"One-digit ";}
else
{if((num>9)&&(num<100))
{cout<<"Two-digit ";}
else
{if (((num>99)&&(num<1000)))
{cout<<"Three-digit ";}
else
{cout<<"you write wrong number\n";b=false;}
}
}
if (b)
{
if (num%2==0)
{ cout<<"pair number\n";}
else
{ cout<<"unpair number\n";}
}
system("pause");
return 0;
 
 
ПРАКТИЧНА РОБОТА 3
Програмна реалізація функцій для роботи з датою та часом
 
Завдання 3.1
Використовуючи класс TDateTime (оголошенийв модулі systdate.h) розробіть застосування для роботи з датою і часом, яке демонструватиме всі можливі операції над ними.
//---------------------------------------------------------------------------
 
#include <vcl.h>
#pragma hdrstop
 
#include "Unit1.h"
#include "systdate.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TDateTime DateTime = TDateTime::CurrentDateTime();
int week=DateTime.DayOfWeek();
switch(week)
{
case 1:{Label1->Caption ="monday"; break;}
case 2:{Label1->Caption ="tuesday"; break;}
case 3:{Label1->Caption ="wednesday"; break;}
case 4:{Label1->Caption ="thursday"; break;}
case 5:{Label1->Caption ="friday"; break;}
case 6:{Label1->Caption ="saturday"; break;}
case 7:{Label1->Caption ="sunday"; break;}
}
Label2->Caption ="DateTime "+DateTime.DateTimeString();
Label3->Caption ="Date "+DateTime.DateString();
Label4->Caption ="Time "+DateTime.TimeString();
DateTime = TDateTime::FileDateToDateTime(FileAge(Application->ExeName));
Label5->Caption = "data and time of file: " + DateTime.DateTimeString();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Application->Terminate();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
TCursor OldCursor = Screen->Cursor;
 Screen->Cursor = crHourGlass;
  TDateTime StartDateTime = TDateTime::CurrentDateTime();
 
 for(int i = 0; i < 500000; i++)
{
TDateTime(TDateTime::CurrentDateTime().DateTimeString());
Application->ProcessMessages();
}
 
 TDateTime EndDateTime = TDateTime::CurrentDateTime();
 
 Screen->Cursor = OldCursor;
 
 Label6->Caption = (EndDateTime - StartDateTime).TimeString();
 
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender)
{
 static TDateTime DateTime = TDateTime::CurrentDateTime();
 Label7->Caption = (DateTime++).DateTimeString();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button5Click(TObject *Sender)
{
static TDateTime DateTime = TDateTime::CurrentDateTime();
  Label8->Caption =(DateTime += 1.125).DateTimeString();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{   String TimeFormat, DateFormat;
   if(CheckBox1->Checked)
DateFormat = "dddddd ";
 else
DateFormat = "ddddd ";
if(CheckBox2->Checked)
TimeFormat = "hh:nn:ss";
else
TimeFormat = "hh:nn";
Label9->Caption = TDateTime::CurrentDateTime().FormatString(DateFormat+TimeFormat);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::CheckBox1Click(TObject *Sender)
{
if(CheckBox1->Checked)
 Label9->Caption = TDateTime::CurrentDateTime().FormatString("dddddd:hh:nn");
 else
Label9->Caption = TDateTime::CurrentDateTime().FormatString("ddddd:hh:nn");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::CheckBox2Click(TObject *Sender)
{
if(CheckBox2->Checked)
Label9->Caption = TDateTime::CurrentDateTime().FormatString("dd.mm.yy.hh:nn:ss");//TimeFormat = "hh:nn:ss";
 else
Label9->Caption = TDateTime::CurrentDateTime().FormatString("dd.mm.yy.hh:nn");// TimeFormat = "hh:nn";
 
}
 
ПРАКТИЧНА РОБОТА 4
Програма для роботи з візуальними компонентами керування
 
Завдання 4.1
За допомогою 2-х контейнерів Panelподіліть простір форми на дві частини (головна та нижня) з прив`язкою до її границь. На головній частині розмістіть кнопку Button. На нижній частині розиістіть компонент TrackBar. При зміні позицій «повзунка» TrackBar реалізуйте можливість зміни прозорості форми. При наведенні миші на кнопку Button реалізуйте можливість зміни її положення відносно форми з нможливістю виходу за межі форми.
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm2::TrackBar1Change(TObject *Sender)
{
Form2->AlphaBlendValue=TrackBar1->Position;
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button1Click(TObject *Sender)
{
int t=Panel1->Height - Button1->Height;
int t2=Panel1->Width - Button1->Width;
Button1->Top=rand()%t;
Button1->Left=rand()%t2;}
 
ПРАКТИЧНА РОБОТА 5
Програми циклічної структури
 
Завдання 5.1
Дано два цілі числа A і B (A<B). Вивести в порядку зростання всі цілі числа, розташовані між AIB(включаючисамі числа A і B), а також кількість N цих чисел.
#pragma hdrstop
#pragma argsused
#ifdef _WIN32
#include <tchar.h>
#else
  typedef char _TCHAR;
  #define _tmain main
#endif
#include <stdio.h>
#include "iostream.h"
 int _tmain(int argc, _TCHAR* argv[])
{
long A=0, B=0, N=0; bool boolean=true;
cout<<"A<B\nA=";
cin>>A;
cout<<"B=";
cin>>B;
Фото Капча